Reprinted please indicate the source: http://narmy.cn/linux/read.php/100.htm
I attended the written examination on the 18 th, and I forgot the written examination on the 18 th. I saw a student with good memory on the Internet remember the written examination on the 13 th and tried to do it:
A total of three parts and seven questions
Part 1: Short answer
1. Describe the depth-first algorithm, breadth-first algorithm, and non-Recursive Implementation features of the tree.
The depth-first search method is a node that has not been extended and has the maximum depth. The breadth-first search method is a node that expands the K + 1 layer only after the node of the K layer is extended. The main difference is that stack is preferred for depth, and queue FIFO is preferred for breadth.
Non-recursive implementation requires the program to set its own stack to save the data to be used. Unlike recursion, recursion requires the system to save the data and program execution status in the stack. Non-recursion can reduce data redundancy and huge overhead caused by system setting stacks.
2. In a file system, what is the basic function of metadata (such as inode in ext2? What is the fundamental difference between ext2 and ext3?
Modify, Access, and Create times of the record data, and the storage block of the record data. Data Consistency can be ensured through the metadata locking mechanism.
Ext3 is an extension of ext2. The main difference is that ext3 is added to the log system. It allows logging in three modes: writeback (ordered) and data. The default value is subscription. By default, logs are submitted when they are fully filled with 1/4 logs or when the timeout period of a log record expires.
3. What is the basic role of Server Load balancer in web Services? Please give an example of a familiar Server Load balancer software or implementation solution, and briefly describe their implementation principles. (The second half of this question is open, and I have not remembered much further. This is probably the case)
Due to the surge in system service traffic and bandwidth, the TCP/IP protocol stack of the server has become a bottleneck because of the inefficiency of the server system and the inefficiency of the processor. Therefore, the emergence of a server Load balancer cluster distributes services evenly to each server that provides the same service, thus reducing the burden on a single server.
LVS (Linux Vitual Server): LVS can be freely developed using the GPL protocol. There are roughly three layers:
1. Server Load balancer: external front-end servers use IPVS (IP Server Load balancer) software and three IP Server Load balancer technologies and eight load scheduling algorithms. Server Load balancer technology, such as direct routing VS/DR, can rewrite the MAC address of the request to send the request to the Real Server, which effectively improves the scalability and throughput of the cluster system. Eight scheduling algorithms, such as the weighted least link method, dynamically send requests to the real server with the least links currently, and use the weighted algorithm to improve performance.
2. Server pool: by increasing the number of nodes in the server pool, performance will often grow linearly. Effectively solved the scalability of the service.
3. shared storage: a database or network file system may also be a distributed file system. The database ensures consistency of concurrent access. static data can be stored in a Network File System, such as NFS or CIFS. if the system is large, distributed file system storage can be used. In addition, shared storage provides large cache capacity for read-intensive services in most cases, so the access speed is close to that of the local disk.
In addition, the HTTPS-based security system management WEB interface allows the system administrator to manage and operate clusters.
4. What are the four major features of database transactions? Please give an example to explain these four features to a person who does not fully understand the database. Database cast Administrator (DBA) is required.
Transaction: atomicity, consistency, separation, and persistence
(1) atomicity
The atomicity of a transaction refers to the fact that the program contained in the transaction acts as the logical unit of work of the database, and any modification to the data is either performed in full or not at all. This feature is called atomicity.
The atomicity of a transaction requires that a transaction can be considered as a program, and it is either completely executed or completely unexecuted. That is to say, the transaction operation sequence can be fully applied to the database or does not affect the database at all. This feature is called atomicity.
If the user completes the database update in a transaction, all the updates must be visible to the external world or have not been updated at all. The former indicates that the transaction has been committed, and the latter indicates that the transaction has been canceled (or aborted ). DBMS must ensure that all operations completed by successfully committed transactions are fully reflected in the database, and the failed transactions have no impact on the database.
(2) Consistency
Transaction consistency means that the database must be consistent before and after a transaction is executed. This feature is called transaction consistency. If the database status meets all integrity constraints, the database is consistent.
The consistency processing database protects all semantic constraints. If the database status meets all integrity constraints, the database is consistent. For example, when the database is in the consistent status S1, execute a transaction on the database. During the transaction execution, assume that the database status is inconsistent. When the transaction execution ends, the database is in the consistent state S2.
(3) Separation
The separation slave concurrent transactions are isolated from each other. That is to say, the operations inside a transaction and the data being operated must be blocked and not seen by other transactions that attempt to modify the data.
Separation is the security guarantee provided by DBMS for conflicts between concurrent transactions. DBMS can provide different levels of separation between concurrent transactions through locking. If the transaction with concurrent cross-execution is not controlled, the execution of multiple concurrent transactions that manipulate the same shared object may cause an exception.
DBMS can provide different levels of separation between concurrent transactions. There is an inverse relationship between the separated level and the throughput of concurrent transactions. A large number of transactions may cause high conflicts and a large number of transaction misoperations. Aborted transactions consume resources, which must be re-accessed. Therefore, ensure that DBMS at the high isolation level requires more overhead.
(4) Persistence
Durability means that when the system or media fails, the update of the committed transaction cannot be lost. That is, once a transaction is committed, the DBMS ensures that its changes to the data in the database should be permanent and can withstand any system faults. Durability is ensured through database backup and recovery.
Durability means that when the system's primary media fails, the updates of committed transactions can be lost. That is, the update of the committed transaction can be restored. Once a transaction is committed, DBMS must ensure proper redundancy so that it can withstand system faults. Therefore, durability mainly lies in the restoration performance of DBMS.
5. A microprocessor with 1 kb memory and 1 MHz (10 ^ 6 operations per MHz) runs programs on such a computer (the program will be automatically terminated upon such termination, does not show an endless loop) How long can it take to run? You can make any assumptions you need.
I cannot understand this question. You need advice.
Part 2-algorithm and Program Design
1. int maxContinuNum (const char * inputstr, char * outputstr)
Write a program to implement this function, return the length of the longest numeric string ending with "\ 0", and assign the first address of the numeric substring to outputstr. You cannot use any library function or existing function, such as strlen.
For example, in the string "abc123abcdef12345abcdefgh123456789", assign the first address of the string to inputstr and return 9. outputstr points to the first address of string "123456789.
Int maxContinuNum (const char * inputstr, char * outputstr)
{
Int maxlen = 0, tmplen = 0, I;
Const char * in = inputstr;
Char * out = outputstr, * temp, * final;
While (* in! = '\ 0 ')
{
If (* in> = '0' & * in {
Tmplen = 0;
For (temp = in; * in> = '0' & * in {
Tmplen ++;
}
}
If (maxlen {
Maxlen = tmplen;
Final = temp;
}
In ++;
}
For (I = 0; I * Out ++ = * final ++;
* Out = '\ 0 ';
Return maxlen;
}
# Include
# Include
# Include
Int main (void)
{
Const char * a = "abc123abcdef174395abcdefgh123456789 ";
Char B [sizeof (a)];
Int max = maxContinuNum (a, B );
Printf ("% d \ n", max );
Printf ("% s \ n", B );
Exit (0 );
}
Part 3 Backup System Design
People who issue questions cannot remember this, and open questions are all played by their accumulation. Haha.