[Computer Operating System MOOC Version] Chapter 1 After-Class Exercises

After-school exercise catalog:

1. Short answer questions

1. What is the goal of configuring an OS on a computer system? In what aspects does it function?

2. Try to explain the relationship between OS and hardware, other system software and users.

3. Try to explain what is the main driving force for OS development.

4. In OS, what are offline I/O mode and online I/O mode?

5. What are the main driving forces that promote the formation and development of time-sharing systems?

6. What are the key issues in implementing a time-sharing system? How to solve it?

7. Why introduce real-time system?

8. What are HRT tasks and SRT tasks? Give an example

9. Try to compare time-sharing systems and real-time systems in terms of timeliness, interactivity and reliability.

10. Microcomputer OS can be divided into what categories according to its operating mode? for example.

11.What are the major features of OS? What's the relationship between them?

12. What causes OS to have asynchronous characteristics?

13.What is the OS kernel? What are the main functions of the OS kernel?

14.What is a primitive language? What are atomic operations?

15. Briefly describe the dual operating mode of the processor.

16. Briefly describe the interrupt handling process.

17.What are the main functions of processor management? What is their main task?

18.What are the main functions of memory management? What is their main task?

19.What are the main functions of device management? What is their main task?

20.What are the main functions of file management? What is their main task?

21. What are the new features of modern OS?

22.What is a microkernel OS? What advantages does it have?

23. What is the basic idea of ​​the outer core OS?

24.What is a system call? What is the difference between system calls and general user programs and library functions?

2. Calculation questions (important)

25. (Important)

26. (Important)

3. Comprehensive application questions

27.What are the concepts, features and functions of OS? (important)

28. Pictures are difficult to draw, please refer to books for details


1. Short answer questions


1. What is the goal of configuring an OS on a computer system? In what aspects does it function?


The main goal of configuring an OS on a computer system is to achieve: convenience, effectiveness, scalability and openness ;
the role of the OS is mainly reflected in the following three aspects:

  • The OS serves as the interface between the user and the computer hardware system;
  • OS serves as the manager of computer system resources;
  • OS implements the abstraction of computer resources.

2. Try to explain the relationship between OS and hardware, other system software and users.


The operating system is the first layer of software covering the hardware. It manages the computer's hardware and software resources and provides a good interface to users. The operating system is closely related to the hardware. It directly manages the hardware resources and completes all hardware-related operations for the user, thus greatly facilitating the user's use of the hardware resources and improving the utilization of the hardware resources. The operating system is a special kind of system software. Other system software runs on the basis of the operating system and can obtain a large number of services provided by the operating system. In other words, the operating system is the interface between other system software and hardware. In addition to operating system support, general users also need to use a large number of other system software and application software to make their work more efficient and convenient.

3. Try to explain what is the main driving force for OS development.


1) The utilization rate of computer system resources continues to increase;
2) User convenience;
3) Devices are constantly updated;
4) Computer architecture continues to develop;
5) New application requirements are constantly being proposed.

4. In OS, what are offline I/O mode and online I/O mode?


The offline I/O method means that the paper tape or card containing the user program or data is loaded into the paper tape input machine or card machine in advance, and under the control of the peripheral machine, the data or program on the paper tape or card is input into On the tape, the I/O operations in this mode are completed under the control of the peripheral machine and are performed without the host machine, so it is called the offline I/O mode. The online I/O method means that the I/O of programs and data is performed under the direct control of the host.

5. What are the main driving forces that promote the formation and development of time-sharing systems?


1) The time-sharing use of the CPU (central processing unit, central processing unit) shortens the average turnaround time of jobs;
2) The provision of human-computer interaction functions allows users to directly control their own jobs conveniently;
3) The sharing of hosts enables many Individual users (including remote users) can use one computer at the same time to process their own jobs independently and without interfering with each other.

6. What are the key issues in implementing a time-sharing system? How to solve it?


The key issue in implementing a time-sharing system: enabling users to interact with their own jobs, that is, after the user enters a command on his or her terminal to request system services, the system can receive and process the command in a timely manner, and execute the command in a timely manner that is acceptable to the user. The results are returned to the user within the delay.
Solution: The way to receive commands and return output results in a timely manner is to configure a multi-channel card in the system and configure a buffer for each terminal to temporarily store the commands input by the user and the output results. Therefore, the key problem to be solved is to ensure that all user programs in the system can be executed once in a short period of time, so that the commands entered by the user can be responded to in a timely manner. To this end, on the one hand, the user job should be entered into the memory immediately after it is submitted; on the other hand, the system should set a very short time called a time slice, and stipulate that each program can only run continuously for a maximum time at a time. If the time slice is used up, the CPU must be given to the next job regardless of whether it has finished running. By allowing jobs to share the CPU in a time-sharing manner, all jobs can be processed in a timely manner, and user requests can also be responded to in a timely manner.

7. Why introduce real-time system?


A real-time system refers to a system that can respond to external event requests in a timely manner, complete the processing of external events within a specified time, and control all real-time tasks to run in a coordinated manner. The real-time system is introduced to better meet the needs of the real-time control field and the real-time information processing field.

8. What are HRT tasks and SRT tasks? Give an example


1) Hard real-time tasks mean that the system must meet the deadline requirements of the task, otherwise unpredictable results may occur, such as launch vehicle control; 2) Soft
real-time tasks do not have strict deadline requirements, and tasks may occasionally be missed. The deadline will not have much impact on the system, such as updating web page content, updating the number of remaining tickets in the train ticketing system, etc.

9. Try to compare time-sharing systems and real-time systems in terms of timeliness, interactivity and reliability.


1) Think about it in terms of interactivity. The issue of interactivity is a key issue in time-sharing systems. In a time-sharing system, users can conduct extensive human-computer interaction with the system through the terminal, such as file editing, data processing, and resource sharing. Real-time systems are also interactive, but in real-time systems, interactivity is limited to accessing some specific dedicated service programs in the system, that is to say, its interactivity has great limitations; 2) From the perspective of
timeliness consider. The timeliness of a time-sharing system means that users can obtain a response from the system within a short time interval. This time interval is determined based on the waiting time that people can accept, which is generally 2 to 3 seconds. For real-time systems, timeliness is one of its key issues. The timeliness requirements of real-time information systems are similar to time-sharing systems, while the timeliness requirements of real-time control systems are determined by the start and end time required by the controlled object. The completion deadline is generally determined by seconds, hundreds of milliseconds, milliseconds, or even lower;
3) Consider reliability. Reliability is another key issue in real-time systems. Any errors in real-time systems may cause huge economic losses and even lead to unpredictable catastrophic consequences. Therefore, real-time systems often adopt multi-level fault tolerance measures to ensure that the system is highly reliable. Although time-sharing systems also require reliability, their requirements are lower than those of real-time systems.

10. Microcomputer OS can be divided into what categories according to its operating mode? for example.


1) Single-user single-task OS: only allows one user to access the computer (use the computer), and only allows the user program to run as a task. It is mainly configured on 8-bit and 16-bit microcomputers. The most representative single-user single-task OS are CP/M (8-bit) and MSDOS (16-bit);
2) Single-user multi-task OS: only one user is allowed to run on the computer, but the user is allowed to divide the program into several tasks Concurrent execution, thus effectively improving system performance. The most representative single-user multi-tasking OS is the Windows series launched by Microsoft, such as Windows 3.1, Windows 95, Windows 98, etc.; 3
) Multi-user multi-tasking OS: allows multiple users to use one machine through their respective terminals , sharing various resources in the host system, and each user program can be further divided into several tasks for concurrent execution, which can further improve resource utilization and system throughput. The most representative multi-user and multi-tasking OS are UNIX systems, various UNIX-like systems (such as Solaris, Linux systems, etc.) and Windows NT/Server series systems.

11.What are the major features of OS? What's the relationship between them?


The four basic features are concurrency, sharing, virtuality and asynchronousness;
1) Concurrency and sharing are the most basic features of OS. In order to improve the utilization of computer resources, the OS must adopt multi-programming technology to enable multiple programs to share system resources and execute concurrently; 2)
Concurrency and sharing are mutually exclusive conditions. On the one hand, the sharing of resources is conditioned on the concurrent execution of programs (processes). If the system does not allow concurrent execution of programs, there will be no resource sharing problem; on the other hand, if the system cannot effectively manage resource sharing, coordination Improving the access of each process to shared resources will definitely affect the concurrent execution of the program, and even make it impossible to execute the program concurrently;
3) Virtuality is based on concurrency and sharing. In order to enable concurrent processes to share resources more conveniently and effectively, OS often uses a variety of virtual technologies to logically increase the number of CPUs and devices and memory capacity, thereby solving the problem of concurrent processes sharing limited system resources; 4)
Asynchronous Sex is the inevitable result of concurrency and sharing. OS allows multiple concurrent processes to share resources and cooperate with each other, so that the running process of each process is restricted by other processes and is no longer "coherent", which will inevitably lead to the emergence of asynchronous characteristics.

12. What causes OS to have asynchronous characteristics?


In a multiprogramming environment, multiple processes are allowed to execute concurrently. However, due to limitations of resources and other factors, the execution of the process is usually not done in one go, but in a stop-and-go manner. It is unpredictable when each process in memory is executed, when it is paused, and at what speed it will advance. Therefore, the order in which jobs are completed is not exactly the same as the order in which they are entered into memory, that is, the process runs asynchronously. However, with the support of relevant process control and synchronization mechanisms, as long as the running environment is the same, the job will obtain exactly the same results after running it multiple times, so the asynchronous method is allowed. Therefore, OS has asynchronous characteristics.

13.What is the OS kernel? What are the main functions of the OS kernel?


In modern OS theory, the OS is generally divided into several levels, and then different functions of the OS are set in different levels. Usually some modules closely related to the hardware (such as interrupt handlers, etc.), drivers of various commonly used devices, and modules with higher running frequencies (such as clock management modules, process scheduling modules, common basic operation modules, etc.) are arranged in In the software layer close to the hardware, they are made to reside in the memory, thus forming the so-called OS kernel.
The main functions of the OS kernel are: ① Support functions, including interrupt processing, clock management, and primitive operations; ② Resource management functions, including process management, memory management, device management, etc.

14.What is a primitive language? What are atomic operations?


Primitive: refers to a process composed of several instructions and is used to complete a certain function;
atomic operation: refers to all the actions in an operation being either done or not done at all. In other words, it is an indivisible basic unit. Therefore, primitives are not allowed to be interrupted during execution. Atomic operations are executed in kernel mode and reside in memory.

15. Briefly describe the dual operating mode of the processor.


Generally, a processor requires at least two separate operating modes: user mode and kernel mode.
1) User mode is also called eye mode, and computer hardware can represent it by setting a mode bit to 1. When the computer system executes the user program, the system is in the user state;
2) The kernel state is also called the tube state or the system state, and the computer hardware can represent it by setting a mode bit to 0. Whenever the OS is able to control the computer, it is in kernel mode. For example, when a user program requests an OS service through a system call, the system must
switch from user mode to kernel mode to respond to the request.

16. Briefly describe the interrupt handling process.


Once the CPU responds to the interrupt, the system begins interrupt processing. The interrupt handling process mainly includes the following three steps.
1) Protect the site of the interrupted process. In order to enable the process to correctly return to the interruption point after the interrupt processing is completed, the system must save the current processor status word and program counter value;
2) Analyze the cause of the interrupt and transfer to the corresponding interrupt processing program. When multiple interrupt requests occur at the same time, the interrupt request issued by the interrupt source with the highest priority is processed;
3) The scene of the interrupted process is restored, and the CPU continues to execute the original interrupted process.

17.What are the main functions of processor management? What is their main task?


The main functions of processor management include process management, process synchronization, process communication and processor scheduling. The main tasks of each part are:
1) Process management, creating processes for jobs, canceling ended processes, and controlling the state transition of processes during running; 2
) Process synchronization, coordinating the running of multiple processes (including threads);
3) Process communication realizes information exchange between cooperating processes;
4) Processor scheduling, including job scheduling and process scheduling. Job scheduling is to select several jobs from the backup queue according to a certain algorithm and allocate the resources required for their operation; process scheduling is to select a process from the ready queue of the process according to a certain algorithm and assign the processor to it , and set the running site to put the process into execution.

18.What are the main functions of memory management? What is their main task?


The main functions of memory management include memory allocation, memory protection, address mapping and memory expansion. The main tasks of each part are:
1) Memory allocation, allocating memory for each program;
2) Memory protection, ensuring that each program only runs in its own memory space and does not interfere with each other;
3) Address mapping, allocating memory in the address space. The logical address is converted into the physical address corresponding to the memory space;
4) Memory expansion, that is, logically expanding the memory to realize the request transfer function and replacement function, etc.

19.What are the main functions of device management? What is their main task?


The main functions of device management include buffer management, device allocation, device processing, and device virtualization. The main tasks of each part are:
1) Complete the I/O requests made by the user, allocate the required I/O devices to the user process, and complete the specified I/O operations; 2) Improve the utilization
of the CPU and I/O devices efficiency, improve I/O speed, and facilitate users to use I/O devices.

20.What are the main functions of file management? What is their main task?


The main functions of file management include: file storage space management, directory management, file read/write management and protection. Its main task is to manage user files and system files to facilitate user use and ensure file security.

21. What are the new features of modern OS?


Modern OS is developed on the basis of traditional OS. In addition to the functions of traditional OS, it also has functions such as ensuring system security, supporting users to obtain services through the Internet, and processing multimedia information.

22.What is a microkernel OS? What advantages does it have?


Microkernel OS has the following four characteristics: ① A sufficiently small kernel; ② Based on the client/server model; ③ Applying the principle of separation of strategies and mechanisms; ④ Using object-oriented technology.
The main advantages of microkernel OS include: ① Improve the scalability of the system; ② Enhance the reliability and portability of the system; ③ Provide support for distributed systems; ④ Incorporate object-oriented technology.

23. What is the basic idea of ​​the outer core OS?


The basic idea of ​​the outer-core OS is that the kernel does not provide abstract things such as processes and virtual storage in traditional OS, but focuses on the isolation (protection) and reuse of physical resources. Specifically, in an OS based on the outer core structure, the kernel is responsible for protecting system resources, while the management responsibilities of hardware resources are entrusted to applications. In this way, the OS can reduce the burden on applications while ensuring resource security. Program restrictions fully meet the different needs of applications for hardware resources.

24.What is a system call? What is the difference between system calls and general user programs and library functions?


System calls are the only interface provided by the OS to programmers. Programmers use system calls to dynamically request and release system resources at the source program level, and call existing system functions in the system to complete work related to the machine hardware part and control the execution speed of the program. Therefore, the system call is like a "black box" that shields the user from the specific actions of the OS and only provides relevant functions.
The difference between system calls and general user programs and library functions is that:
1) System calls (programs) are executed in the kernel mode, and when calling them, an interrupt processing mechanism similar to the hardware interrupt processing mechanism is required to provide system services; 2
) Ordinary users Programs are designed directly for users to complete a specific function, and they are generally executed in user mode;
3) Library functions are a way to put functions into a library for others to use. They are oriented to application development and facilitate people's programming.


2. Calculation questions (important)


25. (Important)

There are three programs A, B, and C. They are executed in order of priority ( A->B->C ). Their calculation time and I/O operation time are as shown in Table 1-1. Assume that the three programs are executed in order of priority ( A->B->C). Use the same device to perform I/O operations in serial mode. Try to draw the time relationship between single program running and multi-program running, and calculate the time it takes to complete these three programs.

 

26. (Important)

There are only two jobs, P1 and P2, in a multi-channel batch processing system. P2 arrives 5ms later than P1 . Their calculation and I/O operation sequence is as follows.
P1: Calculation 60ms, I/O operation 80ms, calculation 20ms.
P2: Calculation 120ms, I/O operation 40ms, calculation 40ms.
Ignoring scheduling and switching time, please calculate the minimum time required to complete both jobs.



3. Comprehensive application questions


27.What are the concepts, features and functions of OS? (important)


The operating system refers to the control and management of the hardware and software resources of the entire computer system, and the rational organization and scheduling of computer work and resource allocation to provide users and other software with convenient interfaces and environments. It is the most basic part of a computer system. system software;


Operating system characteristics (concurrency, shared, virtual, asynchronous);


The functions of the operating system:
1) Act as the interface between the user and the computer hardware system;
2) Act as the manager of computer system resources;
3) Realize the abstraction of computer resources.

28. Pictures are difficult to draw, please refer to books for details

(1) Describe how the processor, input machine, and printer work together in this computational problem.
After the input machine reads the data, the processor performs calculations on the data, and the processed data is finally output on the printer, and so on. (Obviously serial)
(2) Calculate the processor utilization under the execution situation shown in Figure 1-14.
40/320=1/8=0.125=12.5%
​​(3) Briefly describe the reasons for low processor utilization.
The processor, input machine and printer do not work in parallel, and the resources in the system are not fully utilized.
(4) Please draw an implementation plan that can improve processor utilization. (pictured)

During the input process, process it first and then print it.


I hope to be helpful!

Guess you like

Origin blog.csdn.net/weixin_62985813/article/details/133235467