Piscitelli Politecnico di Bari pag. THE PROCESS CONCEPT Textbook uses the terms job, job- step and process almost interchangeably. A job step may be made by a single process or by several concurrent processes. The advantages of segmenting a program in several concurrent processes. Piscitelli Politecnico di Bari pag. SEQUENTIAL EXECUTION Realizzazione sequenziale di un sistema di acquisizione dati Grafo delle precedenze Acquisizione. Piscitelli Politecnico di Bari pag. What are the different phases of a C program from writing code to execution? Compiling the program 3. Step By Step Execution Of C Program Step 1 : Edit This is First Step i.e Creating and Editing Program. Step By Step Execution Of. Preparing Program For Execution Phases Of A C Program Computer Science A from NETWORKING 111 at Kolej Universiti Infrastruktur Kuala Lumpur. Find Study Resources. SEQUENTIAL EXECUTION Timing hypothesis Execution time COLLECT. Piscitelli Politecnico di Bari pag. Realizzazione concorrente di un sistema di acquisizione dati module Acquisizione. Piscitelli Politecnico di Bari pag. L1 L2 L3 C1 C2 C3 S1 S2 S3 R1 R2. CONCURRENT EXECUTION priorit. Piscitelli Politecnico di Bari pag. COOPERATING PROCESSES Independent process cannot affect or be affected by the execution of another process. Cooperating process can affect or be affected by the execution of another process Advantages of process cooperation Information sharing Computation speed- up Modularity Convenience Paradigm for cooperating processes, producer process produces information that is consumed by a consumer process. Concurrent access to shared data may result in data inconsistency. Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating processes. Piscitelli Politecnico di Bari pag. PROCESS AND STATE INFORMATION Process a program in execution; process execution must progress in sequential fashion.
A process is an atomic and independent executing activity, with its own resources. A process includes: program code (text section) processor s registers including program counter process stack (local variables, return address, etc.) data section (global variables) As a process executes, it changes state G. Piscitelli Politecnico di Bari pag. Process Control Block (PCB) Information associated with each process. Process state Program counter CPU registers CPU scheduling information Memory- management information Accounting information (CPU time, Memory, file.. I/O status information G. Piscitelli Politecnico di Bari pag. CPU Switches From Process to Process When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process. Context- switch time is overhead; the system does no useful work while switching. Time dependent on hardware support. Piscitelli Politecnico di Bari pag. CREAZIONE DEI PROCESSI Quando viene creato un processo Al boot del sistema (intrinseci, daemon) Su esecuzione di una system call apposita (es., fork()) Su richiesta da parte dell utente All inizio di un job batch G. Piscitelli Politecnico di Bari pag. PROCESS CREATION Parent process create children processes, which, in turn create other processes, forming a tree of processes. Resource sharing Parent and children share all resources. An Approach for Detecting Execution Phases of a. We define an execution phase as part of a program that implements a. The Execution phase is the real. To the extent performance goals of an existing program are not being met, the execution review may lead to recommendations. You write a C program. Journey of a C Program to Linux Executable in 4. Children share subset of parent s resources. Parent and child share no resources. Execution Parent and children execute concurrently. Parent waits until children terminate. Address space Child duplicate of parent. Child has a program loaded into it. UNIX examples fork system call creates new process exec system call used after a fork to replace the process memory space with a new program. Process A created two child processes, B and C. Process B created three child processes, D,E, and F. Piscitelli Politecnico di Bari pag. PROCESS EXECUTION CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait. Piscitelli Politecnico di Bari pag. SCHEDULERS Long- term scheduler (or job scheduler) selects which processes should be brought from the hold queue into the ready queue. Long- term scheduler is invoked very infrequently (seconds, minutes) (may be slow). The long- term scheduler controls the degree of multiprogramming. Short- term scheduler (or CPU scheduler) selects which process should be executed next and allocates CPU. Short- term scheduler is invoked very frequently (milliseconds) (must be fast). Processes can be described as either: I/O- bound process spends more time doing I/O than computations, many short CPU bursts. CPU- bound process spends more time doing computations; few very long CPU bursts. Piscitelli Politecnico di Bari pag. SCHEDULING QUEUES Each state in the state diagram, except for the run state, corresponds to a queue. The wait queue sometimes is splitted in several queues. Each queue is built up through a linked list of PCB. Piscitelli Politecnico di Bari pag. CPU SCHEDULER Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: 1. Switches from running to waiting state. Switches from running to ready state. Switches from waiting to ready. Scheduling under 1 and 4 are nonpreemptive. All other scheduling are preemptive. Piscitelli Politecnico di Bari pag. DISPATCHER Dispatcher module gives control of the CPU to the process selected by the short- term scheduler; this involves: switching context switching the CPU from supervisor mode to user mode jumping to the proper location in the user program to restart that program Must be speedy Dispatch latency time it takes for the dispatcher to stop one process and start another running. Piscitelli Politecnico di Bari pag. SCHEDULING CRITERIA CPU utilization keep the CPU as busy as possible Throughput # of processes that complete their execution per time unit Turnaround time amount of time to execute a particular process Waiting time amount of time a process has been waiting in the ready queue Response time amount of time it takes from when a request was submitted until the first response is produced, not output (for time- sharing environment) Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time OPTIMIZATION CRITERIA G. Piscitelli Politecnico di Bari pag. CPU SCHEDULER ALGORITHMS round robin la coda di READY . Piscitelli Politecnico di Bari pag. CPU SCHEDULER Round Robin (RR) Classical preemption algorithm for time- sharing systems: as FCFS but with quantized preemption. Each process gets a small unit of CPU time (time slice), usually milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. If there are n processes in the ready queue and the time quantum is q, then each process gets 1/n of the CPU time in chunks of at most q time units at once. No process waits more than (n- 1)q time units. Piscitelli Politecnico di Bari pag. CPU SCHEDULER Round Robin (RR) example with time- slice = 2. Processo Burst Time P 1 5. P 2 1. 7 P 3 6. 8 P 4 2. Diagramma di Gantt G. Piscitelli Politecnico di Bari pag. Modified Round Robin (MRR) CPU SCHEDULER Viene determinata la parte ( t ) di time slice effettivamente impiegata dal processo. Tale valore viene impiegato per calcolare la priorit. Vengono favoriti i processi I/O- bound, che hanno manifestato, nella precedente occasione, attitudine a fare scarso uso della CPU. Piscitelli Politecnico di Bari pag. CPU SCHEDULER Static priority Priorities can be defined: Internally, with parameters measured from the system on the single process (CPU time usage, opened files, memory, I/O usage..) Externally, through process relevance, process owner, economical cost.. Preemptive nonpreemptive SJF is a priority scheduling where priority is the predicted next CPU burst time. Problem Starvation low priority processes may never execute, due to a continuous flow of higher priority processes. Solution Aging as time progresses increase the priority of the unexecuted process. Piscitelli Politecnico di Bari pag. CPU SCHEDULER Dynamic priority (process merit) Durante l intervallo statistico d osservazione T, si calcola il valore dell indicatore di merito per ciascuno dei processi in esecuzione. L indicatore di merito: R i =n i /N i N i =numero di time slice attribuiti al processo i- esimo durante T; n i =numero di volte che il processo i- esimo ha completato l uso del time slice (negli altri casi, il processo . Piscitelli Politecnico di Bari pag. CPU SCHEDULER Dynamic priority (process merit) la determinazione del merito viene usata per estrapolare al successivo intervallo statistico analogo comportamento del task; la coda di READY . Se tutti i valori di R i sono addensati verso 0 (oppure verso 1), il SO regola il valore del time slice diminuendolo (oppure, nell altro caso, aumentandolo). Tale regolazione consente la migliore discriminazione tra i processi I/O Bound e CPU bound, permettendo un migliore utilizzo sia della CPU che dei dispositivi di I/O. Piscitelli Politecnico di Bari pag. MULTIPLE- PROCESSOR SCHEDULING CPU scheduling more complex when multiple CPUs are available. Homogeneous processors within a multiprocessor: the next task can run on anyone of the processors. Anyway a task can be executed on a specific processor. Load sharing: all the processors select the processes from the same ready queue. Asymmetric multiprocessing only one processor accesses the system data structures, alleviating the need for data sharing. Symmetric multiprocessing - the system data structures can be shared; needs special hardware and synchronization controls within the kernel. Piscitelli Politecnico di Bari pag. REAL- TIME SCHEDULING Hard real- time systems required to complete a critical task within a precise and guaranteed amount of time. Firm real- time systems the completion time violation makes the results usefulness to decrease as more as the the time delay increases. Soft real- time systems requires that critical processes receive priority over less fortunate ones. Piscitelli Politecnico di Bari pag. THREADS un processo . Piscitelli Politecnico di Bari pag.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2016
Categories |