However, English four, receive the company's interview questions!

zhaozj2021-02-12  142

However, the English level is four, and the company's interview questions are as follows. Please translate it into Chinese:

The file / * ============================================== ============================================================================================================================================================================================================= ================================================================= * / 锋 彁 彁 涗竴 垪  鍙 鑳 姏镄 姏镄勬潗 鏂 欙 欙 1. 曚 笟 璁 枃 2. 鎴愮 鎴愮? / Span> 3.   璁 や 姣 姣 旇 婊 婊 剰镄勪 剰镄勪 綔鍝? / Span> ----- -------------------------------------------------- ------------------------- B 璇 峰 皢浠ヤ € € €  祫鏂 祫鏂 鏂 鏂? Br> The philosophy of the UNIX system is to provide operating system primitives that enable users to write small, modular programs that can be used as building blocks to build more complex programs. One such primitive visible to shell users is the capability to redirect I / O. Processes conventionally have access to three files: they read from their standard input file, write to their standard output file, and write error messages to their standard error file Processes executing at a terminal typically use the terminal for these three files, but each may be "redirected. "

independently. The second building block primitive is the pipe, a mechanism that allows a stream of data to be passwd between reader and writer processes. Processes can redirect their standard output to a pipe to be read by other processes that have redirected their standar input to come from the pipe. The data that the first processes write into the pipe is the input for the second processes. The second processes could also redirect their output, and so on, depending on programming need. When using the smaller programs as building blocks for a larger, more complex program, the programmer uses the pipe primitive and redirection of I / O to integrate the piece parts. Indeed, the system tacitly encourages such programming style so that new programs can work with existing programs .------ -------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------

THE KERNEL Performs Various Primitive Operations on Behalf of User Processes To Support The User Interface Described Above. Among The Services Provided by the Kernel Are:

Ren? SPAN class = 718400706-26042004> A) Controlling the execution of processes by allowing their creation, termination or suspension, and communication. Ren? SPAN class = 718400706-26042004> B) Scheduling processes fairly for execution on the CPU. Processes share the CPU Processes share the CPU in a time-shared manner:. the CPU executes a process, the kernel suspends it when its time quantum elapses, and the kernel schedules another process to execute The kernel later reschedules the suspended process Ren SPAN..? class = 718400706-26042004> C) Allocating main memory for an executing process. The kernel allows processes to share portions of their address space under certain conditions, but protects the private address space of a process from outside tampering. If the system runs low on free memory, the kernel frees memory by writing a process temporily to secondary memory, called a swap device. If the kernel writes entire processes to a swap device, the implementation of the UNIX system is called a swapp ing system;.? if it writes pages of memory to a swap device, it is called a paging system Ning SPAN class = 718400706-26042004> D) Allocating secondary memory for efficient storage and retrieval of user data This service constitutes the file system. . The kernel allocates secondary storage for user files, reclaims unused storage, structures the file system in a well understood manner, and protects user files from illegal access. Ning? SPAN class = 718400706-26042004> E) Allowing processes controlled access to peripheral devices Such as Terminals, Tape Drives, Disk Drives, And Network Devices.

The kernel provides its services transparently. For example, it recognizes that a given file is a regular file or a device, but hides the distinction from user processes. Similarly, it format data in a file for internal storage, but hides the internal format from user processes, returning a unformatted byte stream. Finally, it offers necessary services so that user processes can support the services they must provide, while omitting services that can be implemented at the user level. For example, the kernel supports the services that the shell needs to act as a command interpreter: It allows the shell to read terminal input, to spawn processes dynamically, to synchronize process execution, to create pipes, and to redirect I / O Users can construct private versions of the shell to tailor their environments. To their specifications without affecting other users. These programs Use The Same Kernel Services as The Standard Shell. ------------------------------------------------------------------------------------------------------------------------------ --------------------------------- ----------------- ================================= ====================== 熺? Br> 骞 窞铻 嶉 € € 氱 缁 熼 泦 鎴 愭 湁 闄 愬 叕鍙? Br>骞 骞 窞 窞 ぉ娌 ぉ娌 尯 尯 尯   眹 眹 涓 涓 ﹀ 悗搴 眹 眹 眹 眹 眹 眹 眹 眹 眹 眹 眹 眹 眹 悗搴 悗搴 眹 悗搴 悗搴 悗搴 悗搴 悗搴 5 5 悗搴 5 悗搴 悗搴 悗搴 悗搴 悗搴 悗搴 悗搴 悗搴 悗搴 0 悗搴 0 0 0 0 0 悗搴 0 悗搴 0

/ * ================================================================================================================================================================ ============================================================================================================================================================================================================= =================== * / appear garbled, but it is barely, I can translate in accordance with the above article.

First translation:

The philosophical idea of ​​UNIX systems is to provide users with a simple operating system. The system allows users to write larger programs as "building blocks" in short and modular programs. It is the ability to relocate I / O to make users use the UNIX shell, it looks simple. Program usually access three files: read from "Standard Input File", write "standard output file", and write error messages to "Standard Error File". The program is executed in the terminal machine, typically, these three files are executed in Terminal. Each of the second simple "streamlines" that may be independently "relocated" is "pipe", and the pipe is a mechanism process that allows data streaming to transfer their standard output to one. The pipe is connected and other process reads, the standard input is from the pipeline, the data of the first process is written to the pipe, and the input of another process can also be redistributed, and so on. Relying on program needs When you use a small program as another larger, more complex program blocks, programmers use simple pipes and relocation I / O to integrate each block. Of course, the system will encourage new programs programming such a style by default to facilitate working with existing programming. The kernel performs various original operations, which represent the user interface described above. There are services provided by the kernel: through the process creation, the process termination, the process hangs, the process is communicated to these operations, the execution scheduling process of the control process is fairly on the CPU, shares the CPU, the process sharing time CPU is a time manner Sharing. The CPU executes a process. When his time allocation time, the kernel will hang him, the kernel will schedule another process, and the kernel will re-resuspend the schedule of the process. Assign a memory to an execution program: The kernel allows the process to share their address space under certain conditions. However, protecting a process private address space from tampering. If the system is running lower than free space. The kernel will release the memory -----------------,, call the switching device, if the kernel reads the entire process to use a exchange measures, and the implementation of the UNIX system is called "exchange System ", if you read and write memory with A Swap Devic, it is called a paging system. Assign secondary memory as efficient storage and retrieval of users, this service constitutes a file system. The kernel assigns the second storage space as the user file. Return unused space, understand the structural file system in a way that is easy to understand, protecting user documents from illegal access to allow process space to access peripheral devices such as terminal, tape devices, disk devices, and network devices. The kernel provides a transparent service. For example: it recognizes a given file is a general file or a device, but it hides one of the user's processes. Similarly, it formatted data into a file to be internal storage. However, the user program hides the internal format. Returns an unformatted byte stream. Finally, it provides the necessary services, and the user program can support this services they must provide. When the omissions can be implemented, in the user layer. (Note) For example, the kernel supports a service: shell needs to play the role of the command interpreter, which allows the shell to read the terminal input. Generate a dynamic program. Go to the synchronization between the processes. Create a pipe, relocate I / O, users can construct a private shell to adapt to their environment and their demand specifications, but have not affected another user. These programs are the most standard shell with the same kernel service

/ * ================================================================================================================================================================ ============================================================================================================================================================================================================= ====================== * / official translation:

The philosophical idea of ​​UNIX systems is to provide a basic system to users. The system can make people with short-hustle, modular program code, and then write more complex code with these blocks. Like "redirection input / output", it is also a building block, which makes it easy to use the use of the UNIX system's shell (translation 1). Process (translation 2 :) usually access three files: "Standard input file", "standard output file" and "standard error file", the former is used to read, the times provide writing, and finally used for writing Error message (translation 3). The program runs in the terminal machine. Typically, the terminals can be used as one of these three "files" (translation 4), each "file" can be independent, unaffected by "relocation". The second building block is "pipe", and the pipeline is also simple. It is a mechanism that enables data streams in "Reading Processes" and "Write Process". The process can "redirect" itself is output to a pipe and allow other processes to read the pipeline, provided that the standard input of these processes must be the above pipeline. The data of the first process is written into the pipe, which can be used as input of the second process. Of course, the second process can also be redirected to their output, depending on the needs of the program. When you want to use a short man as another large and complex program, the user can select a simple "pipe" and "redirect input and output" as a block. Of course, the system Laoli is encouraging such a style to write procedures to work with existing programs. In order to support the user program interface described above, the system core will implement various original operations. Among the services provided by the kernel: process creation, termination, hang, and communication, these operations control the execution of the process. After the process is scheduled, the processor is executed fairly. The process shares the processor time in a time-round manner. The processor executes a program that will hang it when its time is exhausted. Then dispatch another process. Then, the kernel will re-schedule the suspended process. The kernel gives a process to allocate memory. In addition to the protection of the process private address space from being tampered with, under specific conditions, the kernel also allows the process to share their address space. If the memory can be spaced, the kernel will temporarily call the process information, and the exemplary is called a swap device. The UNIX system has two memory management methods, and the memory will be written to the switching area throughout the process information, called "segmentation system". Its two memory is written to the switching area called "paging system" (translation 5). In order to read data efficiently and quickly, the kernel provides a service that is called "file system". The file system uses a very easy understanding manner, that is, user data is stored in the form of a file, and user data is protected from illegal access by file system, and unused deposits are reclaimed by file system. Allows the process to access external settings, such as terminal, tape, disk, and network devices. These services are transparently available in the kernel. For example, the kernel can identify the file to him is a general file (File), or a device (Demolic 6), but the user program is unique. Similarly, the kernel formats the data into the form of the file, but the user program is unique to the internal format of the file. The user uses the original unformatted byte stream (translation 7). Finally, the kernel provides some necessary services. Even if you miss any unware of the service in the user layer, the user program can also implement it. For example, the kernel supports a service called shell.

The service plays the role of the command interpreter, which reads the input program from the terminal, dynamically runs the input process line, and keeps the process between the processes. The shell can also create a pipe, redirect input and output, support users to construct private shells according to their own environment and demand, but will not affect another user. All shells use the same kernel service. Translation Description: 1: Due to the pursuit of translation, "Letter, Ya, Da", I am in translation, the same word will be different in different contexts, so sometimes translation as: user, programmer, user , People, etc. Next: 2: How to show your ability in a short article? I am in the translation process, I usually try to explain the article concept, or through the code to explain the concepts in the article.

User: User, programmer, user. Primitive: Original, simple, basic! Programs: program, program code, process! Secondary Memory: Second memory, translation is "Octave"

Translation 1: "shell" These options are not translated, the shell means the terminal interpreter of the operating system, such as UNIX / Linux Termial Interpretation, DOS / Window9x's Command, WindowsNT 4/5 Explorer et al. 2: Process: General Translation into a process, but sometimes it can be translated as a procedure, which requires the needs of context. Translation 3: "Standard input file", "standard output file" and "standard error file" equivalent to C language cout, cin, cerr, please code A3 translation 4: The general terminal will have "keyboard", "display", The former is "standard input file", the latter is "standard output file", where the file is general, in Unix, any device can be used as a file, including keyboard, display, mouse, disk, etc. Translation 5: The operating system can be paid, and the segmentation system can be paid or segmented. There is no segmentation in the original text, but from the semantics of the article, it means segmentation. Translation 6: The article I tried to "letter" in the translation, reaching "Ya", the original question did not appear "feeding" words, but I think that such translation will vivid, and it is also in line with the original meaning. Translation 7: This sentence means that files are stored in the file system, which is formatted (for example, adding various flag bits, easy to control file system), however, the original user's data is not formatted, but After the file system accepts the request of the user reads the file, it will be responsible for restore.

To illustrate what is "standard input file", "standard output file", "standard error file", write the following code explanation:

/ * ===================================== This program is loaded from the "C standard library" 13 Chapter P603 page, extremely displayed COUT, CIN, CERR application

The program is: a function reads the floating point number from the stream to end-of-file, in this basic capture exception display in CERR ================== ========================= #include "stdafx.h" #include #include namespace mylib {Double ReadandProcessSum (std :: istream & strm ) {Using std :: os; double value, sum;

iOS :: IO_STATE ODLEXCES = Strm.exceptions ();

Strm.exceptions (ios :: Failbit | iOS :: Badbit);

Try {SUM = 0; while (strM >> value) {SUM = value;}} catch (...) {if (! strm.eof ()) {throw;}}

Return 0;}}}

INT Main (int Argc, char * argv []) {usingspace std; double sum;

// cout: The corresponding is the standard output file cout << "Welcome to Su Xianhua Translation Articles to explain the code" << ENDL;

Try {// cin: Corresponding Standard Enter Sum = MYLIB :: ReadandProcessSum (CIN); Catch (Const iOS :: Failure & Error) {

File: // CERR is the corresponding standard error file CERR << "Standard Exception:" << Error.What () << Endl; Return EXIT_FAILURE;}

Cout << "sum:" << sum << endl; return 0;}

--By LittleRoy

2004-7-5

转载请注明原文地址:https://www.9cbs.com/read-6879.html

New Post(0)