[Review of] Computer operating systems review (a)

Operating System Review Problems

Chapter 1 - Introduction to Operating Systems

The role of the operating system

  1. As an interface between the computer hardware system
  2. System resource manager
  3. The abstract of computer resources

Operating system development process

Not configuring the operating system of the computer system

  1. Manual operation, the user exclusive whole machine, waste of resources
  2. Offline O (Off-Line I / O) mode.

Single-batch system

  1. Herein it refers to a lot of batch jobs on a magnetic tape, a one-time input to the computer
  2. Solve human conflicts (each program must perform a manual loading) and the cpu does not match the contradictions and I / O speed of the device. Improve system throughput.
  3. Disadvantages: low utilization of system resources (I / O request is successful before the CPU is idle).

Multi-batch system

  1. Jobs are submitted by users on the external memory, a "backlog."
  2. A B operation performed when performing I / O request, to prevent the CPU is idle.
  3. Multi-channel: 1 and 2 it can be seen from the memory can contain multiple programs at the same time, it is multi-channel.
  4. Benefits: high resource utilization (obviously, refers to the high CPU, a memory, and a data utilization device), a large system throughput (operating system refers to the number of completed lifting unit time)
  5. Cons: average turnaround time is long, no interactive capabilities

Note here that the form is submitted to the task queue in the external memory, and multi-channel refers to the implementation of a memory channel can have multiple programs running.

Time-Sharing System

  1. Time-sharing system appears to meet the needs of human-computer interaction
  2. Sharing: round-robin manner, at intervals slicing a job run.
  3. Time-sharing operating system directly into memory (pay attention).
  4. The key question: receive timely, timely manner.

Real-Time Operating System

The electronic control RM we use is the RTOS.

  1. "Real-time" refers to the "just in time" rather than "real-time computing."
  2. The system provides real-time task time, if not finish within the specified time will no longer perform the task, turn to the next task.
  3. Benefits will not affect each other tasks, such as a very slow execution of tasks quickly and n execution of tasks, real-time operating system will not be a very slow task affect other tasks to perform. And predictability, such as real-time operating system process the data transmission, then you can predict when the next frame of data came, it is possible to make the accelerated reading a cache (typically video frames can be used for processing).

Computer system operability

  1. DOS is a single-user single-tasking operating system
  2. UNIX is a multi-user multi-tasking operating system

The basic features of the operating system

The basic features of the operating system are: concurrent, shared, virtual, asynchronously.

Complicated by

Concurrent multi-channel discharge means operation in memory a plurality of jobs performed in turn in a small time interval, the macro is executed multiprogramming looks over a period of time, each time point micro only one program execution.

parallel

A point in time there is more than one program in execution. For example the use of multi-core operating simultaneously.

virtual

Virtual word to say relatively iffy, in fact, say something back to a name. For example, an area on the hard disk hardware we gave him the name of the C drive disk D and the like, is virtual.

You give something a name from the two, such as a channel from the two names, it seems that there are two channels, so this is a virtual channel.

asynchronous

Asynchronous refers to the inconsistent pace of more than one program, that is, some programs executed faster program execution and some slow, only one CPU, so the overall look is to implement "stop and go" look, so called asynchronous.

The main function of the operating system

The main function of the operating system are: processor management, memory management, device management, file management, and interface between the operating system and the user.

Microkernel operating system

Microkernel is actually a compressed version of the operating system, only a few basic functions.

  1. Small enough kernel
  2. Based on the client / server model
  3. Application "mechanism and strategy separation" principle
  4. Object-oriented technology

Micronucleus goal is to achieve the basic operating rules and system of system services separate. For example, input / output processes locking services may be provided by a service component run outside of micronuclei. More advanced operating system very modular operation of these user mode for the server to complete, this design allows the kernel of the most core part of the design simpler. A service component failure does not lead to collapse of the entire system, the kernel needs to be done, just restart the components without affecting other parts.

In short, we can improve the safety of (this is very clear, the general operation of the operating system on the outside, even if the collapse would not have significant impact), the operating system is relatively lightweight.

The second chapter describes the process control

Process, procedure, thread

process

Process is a program of the first performance.

Process structure: program block, data block, PCB.

PCB: system management and storage of process control data structure information, the operating system is the most important records of the data structure. It is the only sign of the presence of the process.

Conversion process three states:

program

Program is an ordered set of instructions.

It has a static nature.

Thread

Minimum unit of the program execution flow.

A thread is an integral part of the process.

After the introduction of the thread, the thread is the basic unit of scheduling and distribution, but not the basic unit with the resources (except essential resources during operation, the system itself does not possess the basic resources), the process is the basic unit has resources.

If no thread is introduced, the process is the basic unit of scheduling and allocation.

In any case, the process has all the basic unit of resource.

The difference between the process and procedures

  1. Program is static, the process is dynamic.
  2. Process more accurately describe concurrency, and the program can not.
  3. Block PCB process is controlled by a three-part program data and the process thereof.
  4. Processes with other processes to create functional, but the program does not.
  5. The same program run on a number of data collection, it will belong to several different processes. That same program may correspond to multiple processes.

Process Synchronization

Two kinds of restrictive relationship

  1. Indirect mutual restraint relationship: competition for resources between systems, processes independent of each other.
  2. Direct relationship of mutual restraint: inter-process cooperation, related to each other.

Critical Resources

Once only allow a process to access the program.

Critical section

Each program, access to critical resources during that procedure, note the program.

Rule synchronization mechanism to be followed

  1. Let into idle.
  2. Busy waiting.
  3. Limited wait.
  4. Let the right to wait.

These 16 words to back down.

Semaphore mechanism

Semaphore primitives

//P(s)
while s<=0:
    do no-op;
s=s-1;

//V(s)
s+=1;
  1. Exclusive deal
  2. Process synchronization

For mutual exclusion, the mutex semaphore establish a, an initial value, PV operation performed before and after the mutual exclusion. mutex is a representation allows a process to perform, is less than 0 waits, so to meet mutually exclusive request.

For synchronous processing, establishes synchronization semaphore n, the number of signals is allowed to execute.

Specific examples still look better understanding: https://www.cnblogs.com/aoru45/p/11773325.html

Interprocess communication

Shared storage system

Inter-process communication by sharing some of the data structure or the shared memory area.

Pipeline Communication System

Establishing a shared process between reading and writing files, reading time can not write, can not read the time to write.

Messaging system

Without resorting to the shared area data structure, the message is formatted in a unit, the data encapsulated in the message communication, and the communication using a set of commands provided by the operating system, messaging between processes.

Kernel mode, user mode

:( kernel mode kernel mode, all data supervisor mode) CPU can access the memory, including peripheral devices such as hard disks, network cards, cpu themselves may switch from one program to another.

User mode: only restricted access memory, and does not allow access to peripheral devices, the ability to occupy the cpu deprived, cpu resources can be accessed other programs.

Converting user mode to kernel mode is invoked by the system.

Chapter 3 - processor scheduling and deadlock

Processor scheduling level

Divided into three levels: advanced scheduling (Scheduling), intermediate scheduling (scheduling between memory and external memory), low-level scheduling (scheduling process).

Turnaround time

The job is submitted to a system from start to finish the job run time.

The average turnaround time turnaround time is the sum divided by the number of jobs.

Two ways to process scheduling

  1. Non-preemptive: Do not allow a process to seize the processor has been allocated out.
  2. Preemptive mode: given priority, high priority can preempt lower priority process has been performed.

Job scheduling algorithm

First-come, first-served (FCFS)

As the name suggests, according to the order process to the distribution and elimination of the queue.

Short job first (SJF)

Short execution time job to perform.

Priority scheduling algorithm (PSA)

The first implementation of high priority.

Than the highest corresponding priority (HRRN)

Corresponding ratio: turnaround time / operating time.

Thus, according to the corresponding ratio in the first implementation.

example

It says simply, it is easy to understand example.

There are three jobs simultaneously reach, the running time are 3,4,5 2,1,3 priority, in a single processing system by a single road running, the average turnaround time for a variety of SJF and PSA is how much?
\ [SJF: \ frac {3 + (3 +4) + (3 + 4 + 5)} {3} = \ frac {22} {3} \\ PSA: \ frac {4 + (4 + 3) + (4 + 3 + 5)}
{3} = \ frac {23} {3} \\ \] have three job arrival time are 0,1,2, 3,4,5 implementation time are then HRRN the average turnaround time is.

0 A first implementation time, executing the time 3, the case B, respectively, than the corresponding C:
\ [P (B) = (. 4 + 3-1) /. 4 for 1.5 \\ = P (C) = (3 -2 + 5) / 5 = 1.2 \]
Therefore, the first execution of the job B. The last execution of the job C.

The average turnover time:
\ [\ FRAC {(. 3. 3 + + +. 4. 3 + 4-1 + 5-2)} = {6.33}. 3 \]

Process Scheduling

Time-Sharing System

Runner schedule: time-sharing system, i.e., a given time slice, each process gets processor time 1 / n of the time slice, is better understood.

Priority scheduling, multi-queue scheduling, multi-level feedback queue scheduling, scheduling based on the principle of fairness,

Real-Time Systems

Real-time scheduling.

Deadlock

Concept (back): a set of processes, each process have unlimited resources waiting to be occupied by another process in the set of processes, and therefore never get the resources, a phenomenon known as deadlock.

The reason: competition for resources, promote the process of improper order.

Deadlock necessary conditions: exclusive, non-preemptive, and holding request, wait loop.

Deadlock

Deadlock prevention: the destruction requirement.

Avoid deadlock: banker's algorithm.

Deadlock detection, the lifting of the deadlock.

Banker's algorithm

easier. Examples to the book as an example:

Chapter 4 - Memory Management

Loading and linker

To program running on the system, to go through the following steps:

  1. Compiler: a compiler to compile source code into a user number of certain modules
  2. Links: The object modules and libraries needed by the linker links
  3. Load: load a program into memory module.

link

Divided into:

  1. Static links
  2. When loaded dynamic link
  3. Run-time dynamic linking

Load

  1. Absolute load mode
  2. Relocatable manner loaded
  3. Dynamic run fashion into the way

Continuous allocate storage management

The user program into memory is allocated.

  1. A single continuous distribution
  2. Fixed partition allocation
  3. Dynamic partition allocation

Dynamic partition allocation - Dynamic partition allocation algorithm based on sequential search

First fit algorithm (FF)

A first length adapted to assign unassigned partition to the program. Always looking from the top down.

First fit algorithm loop (NF)

FF is the difference between a local NF allocated from the start looking down, looking for a reincarnation.

Best-fit algorithm (BF)

Each time find a minimum of space allocated to the most appropriate program.

The worst adaptation algorithm (WF)

Every time one of the biggest find the most suitable space allocated to the program.

example

Paging management

page

Paged memory management of the logical address space of a process is divided into several pages, and each page numbered, starting at 0, as described in Section 0, page 1 and so on.

Address structure

Paging addresses address structure is as follows:

It contains two parts: the first part is a page number P, the offset part of d, i.e., the page address. For a particular machine, an address structure is constant.

p = address / page size rounded down where d = I address / page size.

Page table

Know how to calculate the offset of the page number and, to calculate the actual physical address, also need to know the page number of the start address in memory, how to know the location of each page is stored in memory - the operating system To each a process of establishing a page table.

The page table address register

Save the start address and length of the current page table page table of the implementation process

The address conversion unit

The basic address translation

By means of a page table, the page table register conversion operations complete the logical address (virtual address) to a physical memory address

Question: several main memory from the virtual address into a physical address, and then complete address access, were interviewed, efficiency is how much? A: The main memory were interviewed twice, the efficiency is 50%

Address conversion table has a fast

A number of additional special cache register (register Lenovo \ fast table) with parallel query capability, save the current part of the implementation process \ whole page table entry,

Specific procedures: quick check table, find the physical address obtained directly access memory, did not find it to access memory page table and then check the physical address access memory found

example

\ [A simple paging systems, there are 2 ^ {24} bytes of physical memory, \\ logical address space 256, and the page size is 2 ^ {10} bytes, \\ logical addresses asked how many bits ? \]

The format is the logical address plus the offset within the page number of the page, i.e. page 256, 8, pages 10 size, it is 18.

A paging system is known, main memory capacity of 4K, 1K page size, for a four large jobs, which are assigned to the page 0,1,2,3 hosted 2,4,6,7 block logical address decimal 1023,2500,3500, 4500 into a physical address.
\ [1023/1024 = 0 \\ found in the second block of the main memory 1023 \; mod \; 1024 = 1023 \\ physical address = 2 \ times 1024 + 1023 = 3071 \]

\ [2500/1024 = 2 of 6 \\ found in main memory 2500 \; mod \; 1024 = 452 \\ Physical Address = 6 \ times 1024 + 452 = 6596 \]

\ [3500/1024 = 3 found in the first main memory 7 \\ 3500 \; mod \; 1024 = 428 \\ physical address = 7 \ times 1024 + 428 = 7296 \]

\ [4500/1024 = 4 can not find the page number, page fault interrupt. \]

Guess you like

Origin www.cnblogs.com/aoru45/p/11793047.html