Genetic computer school computer systems architecture
This presentation is the property of its rightful owner.
Sponsored Links
1 / 42

Genetic Computer School Computer Systems Architecture PowerPoint PPT Presentation


  • 90 Views
  • Uploaded on
  • Presentation posted in: General

Genetic Computer School Computer Systems Architecture. Lecturer: Dr. Nguyen Nam Hong Tel: (04) 8781 437 Mobile: 0912 312 816 Email: [email protected] Chapter 9. Process Management. Chapter 9. Process Management. 9.1. The Process Model

Download Presentation

Genetic Computer School Computer Systems Architecture

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Genetic computer school computer systems architecture

Genetic Computer SchoolComputer Systems Architecture

Lecturer: Dr. Nguyen Nam Hong

Tel: (04) 8781 437

Mobile: 0912 312 816

Email: [email protected]

Chapter 9. Process Management

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Chapter 9 process management

Chapter 9. Process Management

  • 9.1. The Process Model

  • 9.2. Implementation of Processes

  • 9.3. Interprocess Communication

  • 9.4. Process Scheduling

  • 9.5. Deadline scheduling

Dr. Nguyen Nam Hong, Le Quy Don Technical University


9 1 the process model

9.1. The Process Model

  • Process

  • Virtual Time

  • Virtual Memory

  • Process Hierarchies

  • Process States

  • State Transitions

  • The Client-Server Model

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Process

Process

  • A process is a program in execution.

  • In actuality there are many processes running at once

  • The OS gives each process the illusion that it is running alone.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Virtual time

Virtual Time

  • The time used by just these processes.

  • Virtual time progresses at a rate independent of other processes.

  • Actually, the virtual time is typically incremented a little during systems calls used for process switching

  • If there are more other processors, more "overhead" virtual time occurs.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Virtual memory

Virtual Memory

  • The memory as viewed by the process.

  • Each process typically believes it has a contiguous chunk of memory starting at location zero.

  • This can't be true of all processes and in modern systems it is actually true of no processes.

  • The linker provides to the assembler a virtual memory in which addresses start at zero.

    • The linker eventually translates these relative addresses into absolute addresses.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Process hierarchies

Process Hierarchies

  • Modem general-purpose operating systems permit a user to create and destroy processes.

  • Both parent and child keep running and each can create other processes.

    • A process tree results.

    • The root of the tree is a special process created by the OS during startup.

  • A process can choose to wait for children to terminate.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Process states

Process States

  • Create State (New)

  • Blocked State (Suspend)

  • Ready State (Resume)

  • Running State

  • Terminating State

Dr. Nguyen Nam Hong, Le Quy Don Technical University


State transitions

State Transitions

  • A preemptive scheduler

  • A non-preemptive scheduler.

  • The number of processes changes only for two arcs: create and terminate.

  • Suspend and resume are medium term scheduling.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


The client server model

The Client-Server Model

  • One can organize an OS around the scheduler.

    • A minimal "kernel" consists of the scheduler, interrupt handlers, and interprocess communication.

    • The rest of the OS consists of kernel processes that act as servers for the user process (which of course act as clients).

    • The system processes also act as clients (of other system processes).

  • The above is called the client-server.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


9 2 implementation of processes

9.2. Implementation of Processes.

  • Process Table Entries (PTE)

  • Interrupt Vectors

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Process table entries pte 1 2

Process Table Entries (PTE) (1/2)

  • 1. Saved values of registers when process not

    running

  • 2. Stack pointer

  • 3. CPU time used

  • 4. Process id (PID)

  • 5. Process id of parent (PPID)

  • 6. User id (uid and euid)

  • 7. Group id (gid and egid)

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Process table entries pte 2 2

Process Table Entries (PTE) (2/2)

  • 8. Pointer to text segment

  • 9. Pointer to data segment

  • 10. Pointer to stack segment

  • 11. UMASK (default permissions for new files)

  • 12. Current working directory

  • 13. Many others.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Interrupt vectors

Interrupt vectors

  • The OS stores an interrupt vector, which contains the address of the interrupt handler.

  • The interrupt handler is called the interrupt service routine.

  • Actually one can have different priorities of interrupts and the interrupt vector contains one pointer for each level.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


9 3 interprocess communication

9.3. Interprocess Communication

  • Race Conditions

  • Critical Sections

  • Mutual Exclusion

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Race conditions

Race Conditions

  • A race condition occurs when two processes can interact and the outcome depends on the order in which the processes execute.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Critical sections 1 2

Critical Sections (1/2)

  • We must prevent interleaving sections of code that need to be atomic with respect to each other: the conflicting sections need mutual exclusion.

  • If process A is executing its critical section, it excludes process B from executing its critical section.

  • Conversely if process B is executing is critical section, it excludes process A from executing its critical section.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Critical sections 2 2

Critical Sections (2/2)

Requirements for a critical section

  • 1. No two processes may be simultaneously

    inside their critical section.

  • 2. No assumption may be made about the

    speeds or the number of CPUs.

  • 3. No process outside its critical section may

    block other processes.

  • 4. No process should have to wait forever to

    enter its critical section.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Mutual exclusion 1 2

Mutual Exclusion (1/2)

  • The operating system can choose not to preempt itself.

  • No preemption for system processes (if the OS is client server) or for processes running in system mode (if the OS is self service).

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Mutual exclusion 2 2

Mutual Exclusion (2/2)

  • Simply forbidding preemption while in system mode is not sufficient:

  • 1. It does not work for user programs.

  • 2. It does not prevent conflicts between the

    main line OS and interrupt handle's.

  • 3. It does not work if the system has several processors.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


9 4 process scheduling

9.4. Process Scheduling

  • Scheduling Objectives

  • Preemption

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Scheduling objectives

Scheduling Objectives

  • 1. Fairness

  • 2. Efficiency

  • 3. Low response time

  • 4. Low turn-around time

  • 5. High throughput

  • 6. Repeatability

  • 7. Fair across projects

  • 8. Degrade gracefully under load

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Preemption 1 2

Preemption (1/2)

  • 1. Preemption means the operating system

    moves a process from running to ready

    without the process requesting it.

  • 2. Without preemption, the system

    implements "run to completion".

  • 3. Preemption needs a clock interrupt.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Preemption 2 2

Preemption (2/2)

  • 4. Preemption is needed to guarantee

    fairness.

  • 5. Found in all modern general-purpose

    operating systems.

  • 6. Even non-preemptive systems can be

    multiprogrammed.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


9 5 scheduling algorithms 1 2

9.5. Scheduling Algorithms (1/2)

  • Deadline scheduling.

  • First Come First Served (FCFS).

  • Round Robbin (RR).

  • Processor Sharing (Time sharing).

  • Variants of Round Robbin.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Deadline scheduling

Deadline scheduling

  • This is used for real time systems.

  • The objective of the scheduler is to find a schedule for all the tasks (there are a fixed set of tasks) so that each meets its deadline.

  • The run time of each task is known in advance.

  • Actually it is more complicated.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


First come first served fcfs

First Come First Served (FCFS)

  • If the OS "doesn't" schedule, it still needs to store the PTEs somewhere.

  • If it is a queue you get FCFS.

  • If it is a stack (strange), you get LCFS.

  • Only FCFS is considered.

  • The simplest scheduling policy.

  • Non-preemptive.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Round robbin rr 1 2

Round Robbin (RR) (1/2)

  • 1. An important preemptive policy.

  • 2. Essentially the preemptive version of

    FCFS.

  • 3. The key parameter is the quantum size q.

  • 4. When a process is put into the running

    state a timer is set to q.

  • 5. If the timer goes off and the process is

    still running, the OS preempts the process.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Round robbin rr 1 21

Round Robbin (RR) (1/2)

  • 6. When a process is created, it is placed at the rear of the ready list.

  • 7. As q gets large, RR approaches FCFS

  • 8. As q gets small, RR approaches PS (Processor Sharing, described next)

  • 9. What value of q should we choose?

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Processor sharing time sharing

Processor Sharing (Time sharing)

  • Merge the ready and running states and permit all ready jobs to be run at once.

  • The processor slows down so that when n jobs are running at once each progresses at a speed 1/n as fast as it would if it were running alone.

  • 1. Clearly impossible as stated due to the

    overhead of process switching.

  • 2. Of theoretical interest (easy to analyze).

  • 3. Approximated by RR when the quantum

    is small.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Variants of round robbin

Variants of Round Robbin

  • 1. State dependent RR

    • Same as RR but q is varied dynamically depending on the state of the system.

    • Favor processes holding important resources. For example, non-swappable memory.

  • 2. External priorities

    • RR but a user can pay more and get bigger q.

    • But this is not an absolute priority.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


9 5 scheduling algorithms 2 2

9.5. Scheduling Algorithms (2/2)

  • Priority Scheduling

  • Priority Aging

  • Shortest Job First

  • Shortest Remaining Time

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Priority scheduling

Priority Scheduling

  • Each job is assigned a priority and the highest priority ready job is run.

  • 1. If many processes have the highest

    priority, use RR among them.

  • 2. Can easily starve processes.

  • 3. Can have the priorities changed

    dynamically

  • 4. Many policies can be thought of as

    priority scheduling.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Priority aging

Priority Aging

  • As a job is waiting, raise its priority so eventually it will have the maximum priority.

  • 1. This prevents starvation

  • 2. There may be many processes with the

    maximum priority.

  • 3. Can use FIFO among those with max

    priority or can use RR.

  • 4. Priority aging can be applied to many

    policies.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Shortest job first sjf 1 2

Shortest Job First (SJF) (1/2)

  • nonpreemptive

  • This policy is FCFS based, but the process having the shortest expected processing time is selected next.

  • Predictability is reduced for longer processes.

  • Weakness: the programmer is required to estimate the required processing time.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Shortest job first sjf 2 2

Shortest Job First (SJF) (2/2)

  • In a production environment, where the same jobs run over and over again, statistics may be gathered.

  • There is a risk of starvation for long jobs, as long as short jobs keep coming.

  • This policy is still undesirable for an interactive environment because of the lack of preemption.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Shortest remaining time 1 2

Shortest Remaining Time (1/2)

  • It is a preemptive version of SJF.

  • When a new process enters the system, the process that has the shortest expected remaining processing time is chosen to run

  • A new process may indeed preempt the currently running process.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Shortest remaining time 2 2

Shortest Remaining Time (2/2)

  • Weakness: as with SJF, each job must initially give an estimate processing time.

  • The overhead is less than RR because there are less interrupts and process switches.

  • The turnaround time for short jobs is good.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Vocabularies 1 2

Vocabularies (1/2)

  • 1. Critical Section.

  • 2. Deadline Scheduling.

  • 3. First In First Out Scheduling.

  • 4. Memory Placement Policy.

  • 5. MultiPogramming

  • 6. Process.

  • 7. Process Implementing

  • 8. Process Management

Dr. Nguyen Nam Hong, Le Quy Don Technical University


Vocabularies 2 2

Vocabularies (2/2)

  • 9. Processing Scheduling.

  • 10. Priority Aging Scheduling.

  • 11. Priority Scheduling.

  • 12. Round Robin Scheduling.

  • 13. Shortest Job First Scheduling.

  • 14. Shortest Remaining Time Scheduling.

  • 15. Virtual Memory.

  • 16. Virtual Time.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


From examinations 1 2

From Examinations (1/2)

  • 0706Q7b.Explain the following scheduling methods in a large multi-user computer system:

    i. Deadline scheduling

    ii. First In First Out

    iii. Round Robin scheduling

Dr. Nguyen Nam Hong, Le Quy Don Technical University


From examinations 2 2

From Examinations (2/2)

  • 0706Q8b.Explain how processes are implemented in the era of process management

  • 0705Q7. Describe in detail how several processes may sharea single processor in a multiprograming environment.

Dr. Nguyen Nam Hong, Le Quy Don Technical University


  • Login