Network Fundamentals + Database Basics Notes

Source: Internet
Author: User
Tags epoll socket error cpu usage

1.rs-485 is divided into two main categories: two-line, four-line. Wherein, the former requires two data lines, can be used for half-duplex communication, the latter requires four data lines, can be used for full-duplex communication. Therefore, RS-485 has a minimum of two data information numbers. The RS485 uses the differential signal negative logic, -2v~-6v represents "0", and +2v~+6v represents "1". RS485 has two wire system and four-wire two kinds of wiring, four-wire system can only achieve point-to-point communication, is rarely used, now more than the use of two-wire connection mode, which is a bus-type topology on the same bus can hook up to 32 nodes.

2.

30.63.160.2 is a class B IP address. The first 16 bits (two bytes) of the class B IP address are the network number, and the last 16 bits are the host number. Subnetting is a subset of the host number as the subnet number. Here the subnet mask is 255.255.255.0, which is the first three bytes as the network number. The first two words with Class B IP default section as the network number, the third byte is the subnet number, is 160. So the network number of this IP is 130.63 subnet number is 160 host number is 2. 3. Divide a Class C network into 3 subnets, with a minimum of 55 hosts per subnet, and a subnet mask to use?
    • 255.255.255.252
    • 255.255.255.248
    • 255.255.255.224
    • 255.255.255.192

The default form of Class C: 11111111.11111111.11111111.00000000 now requires 3 characters, 2^2 > 3 so you need to borrow two bits to change to: 11111111.11111111.11111111.11000000 Set 11000000 to 192, so choose D

4. Host A and Host B has established a TCP connection, host A to Host B sent two consecutive TCP segments, respectively containing 300 bytes and 500 bytes of payload, the first segment of the serial number is 200, Host B correctly received two segments, sent to host a confirmed serial number is? 200+300+500=1000

"Knowledge points"

The calculation of the confirmation number in the header format of the TCP packet; the confirmation number is the ordinal of the first data byte expected to receive the next message segment of the other. The serial number equals the sum of the number of data bytes in the previous message segment. For example, assuming that the source host sends 3 segments, each segment has 100 bytes of data, and the first segment has a sequence number of 1000, the destination host returns a header with a confirmation number 1100 after the first segment is received. After receiving the second segment of the message (its ordinal number is 1100), the destination host returns confirmation number 1200, and after receiving the third segment, the destination host returns confirmation number 1300.

5.ip address 10.1.8.0/24 and 10.1.9.0/24, which of the following is the correct summary network segment

10.1.8.0/23
10.1.8.0/24 = = 10.1.0000 0.0/2410.1.9.0/24 = = 10.1.0000 1The. 0/24 starts from a different bit and is replaced with 0, which is 10.1.0000 0.0 = 10.1.8.0 Subnet mask is 8+8 +7 = 23 bits So the summary network segment is 10.1.8.0/23 (the first 23 bits are the same) 6.HTTP status code:
    1. Successful status code:
    2. -Server successfully returned to Web page
    3. 304 – not modified
    4. Failed status code:
    5. 400 a request initiated on behalf of a client does not meet some of the server's restrictions on the request, or the request itself has a certain error

    6. 404 – The requested page does not exist
    7. 503 – The server is temporarily unavailable
    8. -Server Internal Error

7. Three handshake, four waves

8.

The OSI Reference model is divided into seven layers, from bottom to top: physical layer, Data link layer, network layer, transport layer, Session layer, presentation layer, application layer

9.

Static routing refers to routing information that is manually configured by a user or network administrator. When the topology of the network or the state of the link changes, the network administrator needs to manually modify the relevant static routing information in the routing table. Direct routing refers to the route used by routers to communicate between networks that are directly connected to each network interface. Direct routing is generated automatically after the IP address of the router network interface is configured, so if you do not have special restrictions on these interfaces, they can communicate directly between the networks they are connected to. The default route is a special route that can be configured with static routes, and some dynamic routing protocols can also generate default routes, such as OSPF and Is-is. In a small interconnect network, the use of default routing reduces the maintenance effort on the router's routing table, thereby reducing memory and CPU usage. Dynamic routing refers to the ability of routers to automatically establish their own routing table, and can be adjusted according to the actual changes in a timely manner. So static routes and default routes are configured manually by the network management. 10.
Database connections are usually long-connected
HTTP services for Web sites are generally short-connected

What is a long connection?

In fact, a long connection is relative to the usual short connection, that is, long time to maintain the client and the server connection state.

The usual short connection operation steps are:

Connect-"Data transfer-" close the connection;

A long connection is usually:

Connect-"Data transmission-" Stay connected-"data transmission-" Stay connected-"...-" close the connection;

This requires a long connection in the absence of data communication, the timing of sending packets to maintain the status of the connection, the short connection in the absence of data transmission directly off the line

When to use long connections, short connections?

Long connections are primarily used for frequent communication between a small number of clients and the server, because at this time the socket error occurs frequently with short connections, and the frequent creation of socket connections is a waste of resources.

However, for the service side, long connections also consume a certain amount of resources, requiring specialized threads (which can be managed under Unix) to maintain the connection state.

in summary, the choice of long connections and short connections is subject to availability.

1. The standard SQL parsing sequence is:

(1). FROM clause, assemble data from different data sources (2). The WHERE clause to filter the records based on the specified criteria (3). The GROUP BY clause divides the data into multiple groupings (4). Use the aggregation function for the calculation (5). Use the HAVING clause to filter the groupings (6). Computes the expression for select All (7). Use order by to sort the result set 2.mysql5.6 start master-slave replication has two Type: Log-based (Binlog); Gtid (global transaction identifier). Error log:-log-err (record start, run, stop MySQL information appears) binary log:-log-bin (record all change data statements, also used for replication, restore Database) query log:-log (log established client connections and executed statements) slow query log:- Log-slow-queries (records all queries that perform more than long_query_time seconds) update log:-log-update (binary log has replaced old update log, update log is no longer used in MySQL 5.1) 3. In tcp/ The data transmission of UDP in IP is unreliable and cannot be used as the communication protocol of MySQL server, the communication protocol that interacts with MySQL server includes tcp/ip,socket, shared memory, named pipe 4. You should try to avoid using or in the WHERE clause to join the condition. Doing so will cause the engine to discard full table scans using the index, such as: Select ID from t where num=10 or num=20 You can query this:
Select ID from t where num=10
UNION ALL
Select ID from t where num=20
(The difference between Union and union all is that union automatically compresses duplicate results in multiple result sets, and union ALL displays all results, whether duplicates or not.) ) 5. If there is a stored procedure Proc1 (employee number, month) in MySQL to query the employee's salary and two parameter types are character types, the following method of calling the stored procedure is correct ()
Call Proc1 (' emp001 '  , ' 201601 ');
Call Proc1 (' emp001 '  , NULL);
6. Both the Epoll and select are I/O multiplexing technologies that enable the state of listening to multiple I/O events simultaneously, while epoll is more efficient than select, mainly based on the I/O event notification mechanism supported by its operating system, and select is based on the polling mechanism Epoll supports both horizontal and edge triggering modes 7.
Uncommitted read (READ UNCOMMITTED): Allows dirty reads, which may read data that has not been committed in other sessions for transaction modification
Read Committed: Read only to data that has been committed
Repeatable read (repeated read): Queries within the same transaction are consistent at the beginning of a transaction
Serial Read (Serializable): Fully serialized read, each read requires a table-level shared lock, read and write each other will block

Network Fundamentals + Database Basics Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.