Operating System Principles Chapter 1 Introduction

Operating System Principles for Undergraduate Students Learning Record
Learning Record Family Bucket

1.1 What is an operating system

1.1.1 Operating system definition

It refers to controlling and managing the hardware and software resources of the entire computer system, and rationally organizing and scheduling computer work and resource allocation, so as to provide users and other software with convenient interfaces and environments.

1.1.2 Objectives of the operating system

Run the user program core target

More efficient use of computer-oriented systems

Easier to use computers for users

1.1.3 Von Neumann

Calculators, controllers, memories, input devices, output devices

1.1.4 Interruption process

Interrupt: When there is a need, the CPU temporarily stops the execution of the current program,

Interrupt signal: a signal sent to the CPU by an external device through an IO operation

Interrupt vector: the entry address of the interrupt program

Interrupt process:

  1. When the CPU executes an instruction, the peripheral device sends an interrupt request to the CPU
  2. When the CPU satisfies the response, it sends an interrupt response signal,
  3. The CPU turns off interrupts and no longer accepts interrupts from another device
  4. The CPU looks for the source of the interrupt request (which device), and saves the CPU's own program counter (PC), etc.
  5. The CPU transfers to the interrupt service routine that handles the interrupt source according to the interrupt number
  6. After the CPU processing ends, restore the scene information, open the interrupt, and return to the next instruction of the original interrupted main program

1.2 Types of Operating Systems

1.2.1 Simple batch processing system

Automated job scheduling

Jobs can be run without human intervention

The core of the simple batch processing system is a resident monitoring program (Monitor)

  • control work transport
  • Schedule job to run
  • Automatically transition from one completed job to the next

Job running process:

CPU and I/O operations are performed alternately, one up and one down CPU pulse I/O pulse

Literally understood, it is a system that processes tasks batch by batch. The strict definition means that the user will no longer intervene after submitting a batch of jobs to the operating system, and the operating system controls them to run automatically. This operating system that uses batch processing job technology is called a batch operating system. The simple understanding is that I have a lot of jobs (quite a program) to run in my hand, and I put them into the memory one by one, and the execution efficiency will be very slow, because I have to manually load the program (early machines will write the program to tape , and then artificially put it in a machine dedicated to processing the program), so I put a batch of jobs at a time, let the operating system run it by itself, and I don't need to intervene, so I save a lot of effort, as shown
below

1.2.2 Multiprogramming systems

  • run interspersed with each other under the control of the hypervisor
  • Allows CPU and IO to run in parallel
  • Devices controlled by different controllers can also operate in parallel, while devices controlled by the same controller generally cannot operate in parallel
  • There is always a job that can be executed
  • When a job is blocked, the OS switches to another job

Purpose:

Make the CPU and the device as busy as possible at all times, thereby increasing the utilization rate of the CPU and the device, and giving full play to the parallelism of the computer system components.

Parallelism: Two or more jobs run at the same time

Concurrency: Two or more jobs run sequentially at the same time interval

1.2.3 Time-sharing system

extension of multiprogramming

A process can be used by multiple users,

Time slice: divide a period of CPU time according to fixed units, and each divided time period is called a time slice

Time-sharing strategy:

Over a period of time, each job runs in turn for a time slice. This allows each job to get a shorter response time to meet the requirements of interactive jobs. An online multi-user interactive operating system following the time-sharing strategy is a time-sharing system

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-3SvkCceN-1641210598966) (E:\Documents and PPT\Junior Course Study\Operating System\Pictures\First Chapter\Time Sharing System.png)]

1.2.4 The difference between time-sharing and batch processing

From their definitions, we can roughly conclude that: Batch processing systems have no human-computer interaction, while time-sharing systems allow multiple users to use the CPU at the same time. Batch processing systems allow programs to occupy the CPU for a long time, while time-sharing systems do not allow

question:

Multiprogramming allocates time according to time slices,

Time slice time is a concept proposed in a time-sharing system,

Multiprogramming has no concept of time slices

1.3 Operation of the operating system

User Mode and Kernel Mode

Mode bits provided by hardware

Privileged instructions: instructions that may cause a system crash and can only run in kernel mode

What if the user program needs to use privileged instructions?

Solution: System call (System call)

Treated as a software interrupt (trap) interrupt source is not the same as interrupt hardware interrupt

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-mj5pePac-1641210598971) (E:\Documents and PPT\Junior Course Learning\Operating System\Pictures\First chapter\syscall.png)]

1.4 Functions of the operating system

1.4.1 I/O and memory protection

I/O protection:

Prevent user programs from performing illegal I/O

Solution: All I/O instructions are privileged instructions

User programs perform I/O operations through system calls

Memory protection:

1.4.2 Timers

If the operating system cannot gain control of the CPU, it cannot manage the system

  • User program infinite loop
  • User programs do not invoke system calls

Solution: Timer

  • An interrupt occurs after a period of time and CPU control returns to the operating system
  • Fixed and variable time timers
  • Implemented using clocks and counters

1.4.3 Process Management

The core goal of the operating system: to run the program

process: running program

CPU/process management: manage CPU

1.4.4 Memory Management

The storage device necessary for the program to run

The CPU can only directly access registers, cache

1.4.5 File Management

Solve the problem of storing information in the computer

Construct the file system with the file as the unit and the directory as the organization

file on external storage

I/O device management

Key: device independence (independence)

Content: Device Driver Device Management

thinking after class

What other privileged instructions?

When are privileged instructions invoked?

What is dual mode in OS? What are the benefits of introducing bimodality?

The dual mode of the operating system is user mode and kernel mode, the application program runs in user mode, and the core operating system components run in kernel mode

user mode

MOOC unit work

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-CArlLObN-1641210598973) (E:\Documents and PPT\Junior Course Learning\Operating System\Pictures\First The first question of Chapter \Unit Test 1.png)]

Guess you like

Origin blog.csdn.net/weixin_45788387/article/details/122291564