编程知识 cdmana.com

Level 4 computer network engineer - Summary of notes on some topics of operating system [1 ~ 10 questions]

Computer level 4 notes

The operating system part :(1~10 topic )

Because the length is too long , To ensure the quality of learning , Then it is divided into four parts ( Four blogs )
Every time 10 Entitled an article , Other topics are in my Level 4 computer network engineer Columns can be found in

The first 1 topic :

  1. Among the various resources that make up the computer system , It mainly includes hardware components and software system ( Code and data
  2. from Computer application Point of view , The main function of the operating system is to provide : Human computer interface
  3. from Software design and development Point of view , The main function of the operating system is to provide : Basic software development platform
  4. from Computer security protection Point of view , The main function of the operating system is to provide : The first line of defense
  5. from Computer system development Point of view , The main function of the operating system is to provide : Virtual machines and extension machines
  6. Operating system as system software , At which level of the software system : On top of hardware , Support software ( Hard upper branch and lower branch
  7. Main functions of the operating system : Implementation of resource management and control procedures
  8. Operating system “ reasonable ” Refer to , Treat different user programs fairly , No lock of life and death and hunger
  9. The data structure is established in the operating system , Its effect is : Understand user needs and current resource usage , Organize resources effectively 、 management
  10. It is random : operating system The kernel switches processes
  11. What is concurrent is : stay In a single processor environment , The two programs alternate in CPU Up operation

The first 2 topic :

  1. There are ways to build an operating system : modularization , Layered , Microkernel , The overall structure

  2. The main part of the operating system : Process threads ( Processor management ), Memory ( Storage ) management , Equipment management , file management

  3. Share at the same time : Hard disk Peripheral Reentrant code

  4. Mutually exclusive sharing ( Can be Shared , But it can't be preempted ): The printer a central processor Memory Scanner

  5. Sure ( meanwhile ) share , And can be preempted : Central processing unit

  6. Which software resources can be shared at the same time : Reentrant code

  7. Which software resources cannot be shared at the same time : Memory allocation module

  8. participatory : Under the control of a certain strategy , Share and use according to different resource types

  9. Randomness : The operating system cannot control the behavior of the running program , And make any prior assumptions about the hardware equipment

  10. have “ concurrency ”: single CPU The system alternately runs the process of integral calculation and disk reading and writing

  11. Program status word (PSW) Status word in :CF,ZF,SF,OF,TF,IF,VIF,VIP,IOPL It doesn't contain Resident bit (A) One letter is not

  12. User visible register : data ( Program ) register , Address register , Condition code register

The first 3 topic :

  1. What cannot be managed as a process is : Interrupt service routine ( Is a fixed code segment )

  2. CPU There are two states , One is User mode , It can only be carried out Non privileged instructions ; One is Kernel mode , Non privileged and privileged instructions Can be executed

  3. The operating system provides : The user interface ( Command input ) and Program interface ( system call )

  4. Kernel state and user state , It means :CPU The state in which it is running

  5. processor From kernel state to user state , use Modify program status word (PSW)

  6. processor From user mode to kernel mode , use The visit management is interrupted ( Call management instructions )

  7. It can run in kernel mode , The instructions that can be run in user mode are : Set the shift direction sign

  8. Which flag bit or status code is not included in the program status word (PSW) in : Condition code (C)

  9. Both interrupts and exceptions interrupt the normal program , Resume execution after completing the corresponding processing , But there is a difference between the two .

    Interruption is a kind of artificial external interference , An exception is an internal interruption of the system itself , so , The user presses the left mouse button It belongs to interrupt

  10. Interrupt is caused by External events It caused , The exception is caused by The instruction being executed ( Internal events ) It caused .

The first 4 topic :

  1. Do not belong to IO( Input and output ) Interruptions : Instruction error
  2. When the user writes the program fork() Create a process , It uses what interface the operating system provides to the user : system call
  3. When users write programs , To draw a red circle on the screen , Need to use : system call
  4. Anyone who **“ What the user program wants to do ”**, All are system call
  5. Interrupt handler Entrance address Which of the following data tables is generally stored in : Interrupt vector table
  6. external I/O The interrupt signal sent by the device to the processor is also called : Interrupt request
  7. Which is not an interrupt but an exception : Divide by zero
  8. Usually with **“ Program ”,“ Instructions ”,“0 except ”,“ The arithmetic ”,“ Memory ” Equal word , All are abnormal **.
  9. When a running process does not want to be disturbed by external events , May adopt : Mask interrupt
  10. Which interrupt is related to the currently running process ( Ask in disguise “ abnormal ”): Procedural interruption
  11. Interrupt source : Refer to The events that caused the interruption
  12. Interrupt request : Refer to The signal sent by the interrupt controller to the processor
  13. Interrupt response : Refer to The processor pauses the current program , Turn to the interrupt handler
  14. Break point : Refer to Pause point of running program
  15. Not a system call : Convert an integer variable to a floating-point variable
  16. system call , The calling program and the called program are located in Different states , Caller at User mode , The called program is located in Nuclear mentality
  17. ( commonly ) Procedure call , Both the calling program and the called program are located in User mode

The first 5 topic :

  1. The only interface that the operating system provides users with for application programming is : system call

  2. Non privileged instructions : Arithmetic instructions

  3. Privileged orders : Set control register instruction , Off interrupt instruction , Mask interrupt , Switch stack pointer instruction , Cancel pointer count

  4. Microkernel structure characteristic : Flexibility and scalability , reliability , Portability , Suitable for distributed system

  5. The time slice should be set to : slice = Time ÷ The number of users eg: 100 ÷ 100 = 1 , So it is ≤1ms

  6. The functions that cannot be realized by system call are : The calling program is nested and recursive many times

  7. open( read ), Belongs to the system call File action class

  8. function fork(), Create a process , Belongs to... In system call Process control class

  9. There is no way to pass parameters : Pass... Through variables

  10. Both procedure calls and system calls can Nesting uses

  11. Called program return Description of the calling program : The procedure call returns directly to the calling program , The system call runs the scheduler before returning to the caller

  12. Not a system call : Find a student information in the database ( Belongs to the database )

  13. Not a system call : Find the maximum number in the array ( lookup )

  14. Not a system call : Fill the grades in the student grade database ( database )

  15. Resources owned by threads ( Thread related users 【 System 】 Stack ): Counter + register + Stack

The first 6 topic :

  1. Process control block It has one-to-one correspondence with the process

  2. What works in parallel is :CPU With external devices

  3. The meaning of multiprogramming is : Macroscopically, there are multiple processes running in the computer at the same time

  4. Process priority Where to store it : Process control block ( As long as it's with **“ process ” Of , ask Where to store it **, Just choose Process control block

  5. In the process control block, not in the process : Process priority

  6. Compared with single program operation , Multiprogramming running concurrently no longer has Reproducibility

  7. Information in the process user stack You don't need to save it in the process control block

  8. So-called ” Reentrant program “, Refer to : Pure code program , There is no need to modify

  9. Process control block (PCB) Organization style : Linear method , Index method , Linking methods

  10. Process control block (PCB) The content of can generally be divided into Scheduling information and Site information Two major parts .

  11. Site information : Program Status word , The clock Information , Boundary address register

  12. Scheduling information :( Yes 7 Kind of ) Eliminate the on-site information

  13. The dynamics of the process : Refers to the process dynamic produce 、 dynamic change 、 dynamic Extinction

  14. Independence of the process : A process is a relative process complete Resource allocation unit

  15. Asynchrony of process : Each process follows its own 、 unpredictable Speed forward

  16. The meaning of multiprogramming : Allow multiple programs to enter memory and run at the same time

The first 7 topic :

  1. Linux Status of system support : Running state 、 Zombie state 、 Sleep state 、 Interrupt state

  2. The reason why a process changes from running state to blocking state is : The required data is not ready

  3. The transition of a process from a waiting state to a ready state is called : Wake up the

  4. A single core processor has 20 A process , There are at most a few running processes :1 individual , At least a few :0 individual ( As the number of words written )

  5. A single core processor has 20 A process , The maximum number of processes in the ready state is :19 individual , At least a few :0 individual ( As the number of articles written )

  6. A single core processor has 20 A process , There are at most a few processes in a blocked state :20 individual

  7. some 4 The computer system with nuclear processor has 50 A process , There are at most a few running processes :4 individual , At least a few :0 individual ( As the number of words written )

  8. some 4 The computer system with nuclear processor has 50 A process , There are at most a few processes in the ready state :49 individual , At least a few :0 individual ( As the number of articles written )

  9. The computer system of an eight core processor has 150 A process , There are at most several processes running at any time :8 individual , At least a few :0 individual ( As the number of words written )

  10. The computer system of an eight core processor has 150 A process , There are at most a few processes that are ready at any time :149 individual , At least a few :0 individual ( As the number of articles written )

  11. A server is equipped with four processors , Each processor has eight cores . share 240 A process , And support multithreading , There are at most a few running processes :4 x 8 = 32 individual

The first 8 topic :

  1. fork() Call once , Go back twice , so fork() The statement after the function executes twice

  2. commonly Something about the process , All stored in Process control block in

  3. The process changes from blocked state to suspended state , The primitives used are :suspend()

  4. Primitive and meaning :suspend() Hang up 、block() The block , Blocking 、wake up() Wake up the 、active() Activate

  5. The operating system changes the process state mainly through Call the process control primitive Realized

  6. If a process is due to requested memory resources Not satisfied for a long time , Then the process will be Hang up

  7. A change in the state of one process will inevitably lead to a change in the state of another process : Running state ——》 Blocked state ( Bad change process )

  8. Use process creation primitives Create a process The order of time : apply PCB Process control block ——》 Fill in PCB——》 Put in the ready queue

  9. Use process undo primitives Undo process The order of time : Find the corresponding process PCB, Undo the descendant process under it , Release the process resources , Cancel the PCB

  10. Use the process wake primitive Wake-up process The order of time : The process was found in the waiting queue PCB, modify PCB The process status is ready , Insert it into the ready queue

  11. Use process blocking primitives Blocking process The order of time : interrupt CPU perform , Keep site information , modify PCB The status of the process in is blocked , Insert it into the blocking queue

  12. How process control blocks are organized : Linear table mode 、 Index table mode 、 Linked list mode ( Ingenious notes : A chain of wires

  13. Part of the process : Process control block 、 Program code 、 data

  14. After the process is created Its process control block forms multiple queues , Which queue is not in these queues : Scheduling queues

  15. Process control primitives : priority , Hang up , Activate , Blocking , Wake up the

  16. In order to facilitate system control and describe the activity process of the process , A special data structure is defined for the process in the operating system kernel , be called : Process control block (PCB)

The first 9 topic :

  1. Thread operation pthread**_join** The implication is : Wait for a specific thread to exit

  2. Thread operation pthread _yield It means : Thread out CPU

  3. Analyze program questions : The first one is : Son and father in pure English (child[son] parent[dad]) topic , all choose A Guarantee child[son] stay parent[dad] front ( The son is in front of the father )

  4. How many processes will be derived when the program runs normally : Three consecutive fork() , first fork() produce 2 individual , the second fork() produce 4(2^2) individual , Third fork() produce 8 (2^3) individual , because fork() Is a continuous , So only take the most , so 8 individual .

  5. Print **“HelloWorld”** How many : A single line **“HelloWorld”** Count one ; first fork() produce 2 individual , the second fork() produce 4(2^2) individual , Third fork() produce 8 (2^3) individual , because fork() Not continuous , So add them together .

The first 10 topic :

  1. Operations that do not cause process scheduling : A process changes from ready state to running state / The newly created process enters the ready queue ( Yes CPU Let out , Will cause process scheduling )
  2. Common thread library functions :pthread_create() establish 、pthread_exit() end 、pthread_yield() Give up CPU、pthread_join() sign out CPU
  3. The tube can't guarantee mutual exclusion ( Management cannot solve the problem of process mutual exclusion )
  4. pthread_mutex_init() It means : Create a mutex
  5. Program analysis questions : see “HelloWorld” hinder sentence (eg: pthread_exit(0) ), if There is no statement after it , Look for The statement at the end of the whole program body notes : Pay attention to flexibility in such questions :exit() Exit ( end ) It can be expressed as : Active exit after operation ; yield() To give up It can be expressed as : Active release CPU To other threads ;join() Exit It can be expressed as : Wait for a specific thread to exit after running
  6. Create thread , The thread of by :pthread_create(&tid, NULL , th_f , NULL);
  7. When pthread_create After successful operation , How many threads does the process have :( Ingenious notes : The successful running :2 individual , Run failed :1 individual )

版权声明
本文为[HHppGo]所创,转载请带上原文链接,感谢
https://cdmana.com/2022/134/202205141324526733.html

Scroll to Top