Operating Systems. Hoofdstuk 3 Beschrijving en besturing van processen. William Stallings. Windows Cluster UNIX. Apple ANDROID.

Vergelijkbare documenten
Hoofdstuk 3: Processen: Beschrijving en Besturing. Wat is een proces? Waarom processen? Wat moet het OS ervoor doen? Is het OS zelf een proces?

General info on using shopping carts with Ingenico epayments

MyDHL+ Van Non-Corporate naar Corporate

Handleiding Installatie ADS

ICT Infrastructuren: Processen en Threads. 18 november 2013 David N. Jansen

Basic operations Implementation options

Settings for the C100BRS4 MAC Address Spoofing with cable Internet.

Handleiding Zuludesk Parent

2019 SUNEXCHANGE USER GUIDE LAST UPDATED

SAMPLE 11 = + 11 = + + Exploring Combinations of Ten + + = = + + = + = = + = = 11. Step Up. Step Ahead

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE. Toets Inleiding Kansrekening 1 8 februari 2010

Het begrip 'Proces' Proces-toestand

RECEPTEERKUNDE: PRODUCTZORG EN BEREIDING VAN GENEESMIDDELEN (DUTCH EDITION) FROM BOHN STAFLEU VAN LOGHUM

(1) De hoofdfunctie van ons gezelschap is het aanbieden van onderwijs. (2) Ons gezelschap is er om kunsteducatie te verbeteren

Procedure Reset tv-toestellen:

Data Handling Ron van Lammeren - Wageningen UR

Het beheren van mijn Tungsten Network Portal account NL 1 Manage my Tungsten Network Portal account EN 14

Centrale begrippen hoofdstuk 3. Waarom multiprogramming? Vandaag. processen proces state: running, ready, blocked,... Vragen??

CTI SUITE TSP DETAILS

Activant Prophet 21. Prophet 21 Version 12.0 Upgrade Information

Intermax backup exclusion files

Registratie- en activeringsproces voor de Factuurstatus Service NL 1 Registration and activation process for the Invoice Status Service EN 10

Introductie in flowcharts

DALISOFT. 33. Configuring DALI ballasts with the TDS20620V2 DALI Tool. Connect the TDS20620V2. Start DALISOFT

Registratie- en activeringsproces voor de Factuurstatus Service NL 1 Registration and activation process for the Invoice Status Service EN 11

L.Net s88sd16-n aansluitingen en programmering.

Memory Management. Virtual Memory. Eisen Memory Management. Verdelen geheugen over meerdere processen

Process Mining and audit support within financial services. KPMG IT Advisory 18 June 2014

ICARUS Illumina E653BK on Windows 8 (upgraded) how to install USB drivers

CBSOData Documentation

EM7680 Firmware Auto-Update for Kodi 17.2

EM7680 Firmware Update by OTA

Cambridge Assessment International Education Cambridge International General Certificate of Secondary Education. Published

Interaction Design for the Semantic Web

Chapter 4 Understanding Families. In this chapter, you will learn

MyDHL+ ProView activeren in MyDHL+

Daylight saving time. Assignment

This appendix lists all the messages that the DRS may send to a registrant's administrative contact.

EM7580 Firmware Update by Micro SD card

ANGSTSTOORNISSEN EN HYPOCHONDRIE: DIAGNOSTIEK EN BEHANDELING (DUTCH EDITION) FROM BOHN STAFLEU VAN LOGHUM

Plotten. technisch tekenwerk AUTOCAD 2000

MyDHL+ Uw accountnummer(s) delen

The genesis of the game is unclear. Possibly, dominoes originates from China and the stones were brought here by Marco Polo, but this is uncertain.

EM7680 Firmware Update by Micro SD card


B1 Woordkennis: Spelling

Add the standing fingers to get the tens and multiply the closed fingers to get the units.

Installatie van Windows 10 op laptops. Windows 10 installation on laptops

2010 Integrated reporting

Beter, Sneller, Mooier. Processoren 27 maart 2012

liniled Cast Joint liniled Gietmof liniled Castjoint

CBSOData Documentation

0515 DUTCH (FOREIGN LANGUAGE)

L.Net s88sd16-n aansluitingen en programmering.

Firewall van de Speedtouch 789wl volledig uitschakelen?

How to install and use dictionaries on the ICARUS Illumina HD (E652BK)

NCTS - INFORMATIE INZAKE NIEUWIGHEDEN VOOR 2010

Impact en disseminatie. Saskia Verhagen Franka vd Wijdeven

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE

Contents. Introduction Problem Definition The Application Co-operation operation and User friendliness Design Implementation

AVG / GDPR -Algemene verordening gegevensbescherming -General data Protection Regulation

Belangrijkste ideeën/concepten uit OS, incl. proces

Classification of triangles

Hoe te verbinden met NDI Remote Office (NDIRO): Apple OS X How to connect to NDI Remote Office (NDIRO): Apple OS X

BE Nanoregistry Annual Public Report

0515 FOREIGN LANGUAGE DUTCH

VOORSTEL TOT STATUTENWIJZIGING UNIQURE NV. Voorgesteld wordt om de artikelen 7.7.1, 8.6.1, en te wijzigen als volgt: Toelichting:

Issues in PET Drug Manufacturing Steve Zigler PETNET Solutions April 14, 2010

MyDHL+ Duties Taxes Paid

Leeftijdcheck (NL) Age Check (EN)

MyDHL+ Exportzending aanmaken

Beter, Sneller, Mooier. Processoren 12 januari 2015

FOD VOLKSGEZONDHEID, VEILIGHEID VAN DE VOEDSELKETEN EN LEEFMILIEU 25/2/2016. Biocide CLOSED CIRCUIT

FAAC DRIVER. Driver install procedure for FAAC boards. Installatieprocedure voor driver voor FAAC-kaarten.

EM7680 Firmware Update by Micro SD card or USB

Travel Survey Questionnaires

Datamodelleren en databases 2011

! GeoNetwork INSPIRE Atom!

Today s class. Digital Logic. Informationsteknologi. Friday, October 19, 2007 Computer Architecture I - Class 8 1

DBMS. DataBase Management System. Op dit moment gebruiken bijna alle DBMS'en het relationele model. Deze worden RDBMS'en genoemd.

GOVERNMENT NOTICE. STAATSKOERANT, 18 AUGUSTUS 2017 No NATIONAL TREASURY. National Treasury/ Nasionale Tesourie NO AUGUST

Ontpopping. ORGACOM Thuis in het Museum

Genetic code. Assignment

ALGORITMIEK: answers exercise class 7


Installatie instructies

Quick start guide. Powerbank MI Mah. Follow Fast All rights reserved. Page 1

OUTDOOR HD BULLET IP CAMERA PRODUCT MANUAL

Four-card problem. Input

AE1103 Statics. 25 January h h. Answer sheets. Last name and initials:

MyDHL+ Tarief berekenen

Evaluation of Measurement Uncertainty using Adaptive Monte Carlo Methods

Tentamen Objectgeorienteerd Programmeren

GS1 Data Source. Guide to the management of digital files for data suppliers and recipients

Bescherming van (software) IP bij uitbesteding van productie

[BP-ebMS-H-000] Welke versie van Hermes moet er gebruikt worden?

Pure Bending. A beam satisfying above given requirements are shown below: Why this surface is called neutral will be explained later in the lecture.

Deel 1: schriftelijk deel

LONDEN MET 21 GEVARIEERDE STADSWANDELINGEN 480 PAGINAS WAARDEVOLE INFORMATIE RUIM 300 FOTOS KAARTEN EN PLATTEGRONDEN

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE. Toets Inleiding Kansrekening 1 7 februari 2011

Transcriptie:

William Stallings Operating Systems Hoofdstuk 3 Beschrijving en besturing van processen UNIX Windows Cluster ANDROID Apple unix G..A. van Lierop LOGO LINUX www.themegallery.com

Operating Systems: Internals and Design Principles De voornaamste taak van een OS is het beheren van processen. Het OS moet systeembronnen toewijzen aan processen, deze in de gelegenheid te stellen om informatie te delen en uit te wisseelen, de bronnen van elk process afschermen en synchronisatie met elkaar mogelijk maken.

Een computer bestaat uit een verzameling hardware bronnen. Computer toepassingen zijn ontwikkeld om een bapaalde taak uit te voeren. It is inefficient for applications to be written directly for a given hardware platform The OS was developed to provide a convenient, feature-rich, secure, and consistent interface for applications to use We can think of the OS as providing a uniform, abstract representation of resources that can be requested and accessed by applications BV. OS bepaald als bronnen gedeeld of gebruikt worden. Het is abstract omdat de acties van de OS onzichtbaar zijn voor de gebruiker

OS Management van de uitvoering van toepassingen Bronnen beschikbaar gemaakt worden voor verschillende toepassingen. De fysieke processor schakelt tussen verschillende toepassingen. De processor en de I/O apparaten efficient kunnen worden gebruikt.

Process Elements Two essential elements of a process are: Program code which may be shared with other processes that are executing the same program A set of data associated with that code When the processor begins to execute the program code, we refer to this executing entity as a process

Tijdens de uitvoering van het programma, kan dit proces eenduidig gekenmerkt worden door een aantal elementen waaronder: identifier state priority program counter memory pointers context data I/O status information accounting information

Proces Besturings Block Wordt door een OS gecreerd en beheert Contains the process elements Makes it possible to interrupt a running process and later resume execution as if the interruption had not occurred Key tool that allows support for multiple processes, dus multiprogramming)

Process Process Implementation Process Control Blocks Active Context Process BYU CS 345 Chapter 3 - Processes 8

Process States Spoor/Trace Het gedrag van een individueel process kunnen we beschrijven aan de hand van de volgorde van instructies die voor dat proces wordt uitgevoerd. Het gedrag van de processor beschrijven door te tonen hoe de sporen van de diverse processen worden verwerven. Toedeler/Disp atcher Een klein programma dat de processor wisselend toewijst aan een ander proces

Process Execution

Traces of Processes of Figure 3.2 Each process runs to completion Figure 3.3

Combined Trace of Processes of Figure 3.2 Figure 3.4

Process Process Trace An instruction trace reveals the overhead required to multi-process. BYU CS 345 Chapter 3 - Processes 13

3.2.1 Procesmodel met 2 toestanden A process may be in one of two states: Actief/running Niet actief/not-running

Diagram wachtrij/queuing Diagram

3.2.2 Creeren en beeindigen van processen Table 3.1 Redenen voor het creeren van eenproces

3.2.2 Creeren van processen Process spawning Wanneer de OS een process creert op verzoek van een ander proces. Parent process is the original, creating, process Child process is the new process

Beeindiging van processen Er moet een manier zijn voor een process om aan te geven dat zijn taak is voltooid.hoe weet de OS wanneer een proces is voltooid? A batch job should include a HALT instruction or an explicit OS service call for termination Bij een gebruiker van een interactieve toepassing duidt de actie van de gebruiker aan dat een process is voltooid.

Table 3.2 Redenen voor het Beeindigen van processen Normal completion Time limit exceeded Memory unavailable Bounds violation Protection error Arithmetic error Time overrun I/O failure Invalid instruction Privileged instruction Data misuse Operator or OS intervention Parent termination Parent request The process executes an OS service call to indicate that it has completed running. The process has run longer than the specified total time limit. There are a number of possibilities for the type of time that is measured. These include total elapsed time ("wall clock time"), amount of time spent executing, and, in the case of an interactive process, the amount of time since the user last provided any input. The process requires more memory than the system can provide. The process tries to access a memory location that it is not allowed to access. The process attempts to use a resource such as a file that it is not allowed to use, or it tries to use it in an improper fashion, such as writing to a read-only file. The process tries a prohibited computation, such as division by zero, or tries to store numbers larger than the hardware can accommodate. The process has waited longer than a specified maximum for a certain event to occur. An error occurs during input or output, such as inability to find a file, failure to read or write after a specified maximum number of tries (when, for example, a defective area is encountered on a tape), or invalid operation (such as reading from the line printer). The process attempts to execute a nonexistent instruction (often a result of branching into a data area and attempting to execute the data). The process attempts to use an instruction reserved for the operating system. A piece of data is of the wrong type or is not initialized. For some reason, the operator or the operating system has terminated the process (e.g., if a deadlock exists). When a parent terminates, the operating system may automatically terminate all of the offspring of that parent. A parent process typically has the authority to terminate any of its offspring.

3.2.3 Procesmodel met 5 toestanden

Procestoestand bij het spoor van figuur 3.4

Using Two Queues

Multiple Blocked Queues

De noodzaak van Swapping involves moving part or all of a process from main memory to disk when none of the processes in main memory is in the Ready state, the OS swaps one of the blocked processes out on to disk into a suspend queue to make room for a new process, or a previously suspended process that is now ready to execute Commonly used in systems that had no virtual memory; less likely to be used with virtual memory since process size can be controlled through the paging mechanism.

Met 1 toestand opgeschort

Met 2 toestanden opgeschort

Andere toepassingen van opschorten 1. Het process is niet onmiddelijk beschikbaar voor uitvoering 2.The process may or may not be waiting on an event 3.Het process werd in de toestand opgeschort geplaatst door het process zelf of door een ander process om de uitvoering van het process te verhinderen. 4. The process may not be removed from this state until the agent explicitly orders the removal

Redenen voor het opschorten van processen Table 3.3 Reasons for Process Suspension

3.3 Beschrijven van processen What does the OS need to know to manage processes & resources?

3.3.1 Beheerstucturen in het besturingssysteem

3.3.1 Beschrijven van processen Wordt gebruikt voor het bijhouden van het hoofdgeheugen en het secundaire geheugen. Processen worden ondergebracht in het secundaire geheugen met een eenvoudige vorm van swapping. Must include: Toewijzen van hoofdgeheugen aan processen Toewijzing van secundair geheugen aan processen Bescherming attributen van blocks van hoofd-of virtueel geheugen Alle info die nodig is voor het beheren van het virtuele geheugen

3.3 Beschrijven van processen Used by the OS to manage the I/O devices and channels of the computer system At any given time, an I/O device may be available or assigned to a particular process If an I/O operation is in progress, the OS needs to know: the status of the I/O operation the location in main memory being used as the source or destination of the I/O transfer

3.3.1 Beschrijven van processen Een groot deel of zelfs alle informatie wordt bijgehouden en gebruikt door het filemanagament systeem. Bij andere besturingssystemen worden veel details van het bestandbeheer aan een OS overgelaten These tables provide information about: existence of files location on secondary memory current status other attributes

3.3.1 Beschrijven van processen Wordt bijgehouden door het beheren van processen. Proces tabellen moeten direct of indirect verwijzen naar geheugen, I/O en bestand tabellen e.g., pointers from each individual process entry to its data in the other three sets of tables. The tables themselves must be accessible by the OS and therefore are subject to memory management Processes are represented by a process image

Process Components Process Attributes 3.3.2 Beheerstructuren van processen Proces Locatie Proces Attributen Een process bevat ten minste 1 uit te voeren programma of verzameling programma s. Een process zal daarom op zijn minst bestaan uit voldoende geheugen voor het opslaan voor programma s en gegevens van een process. Bij de uitvoering van een programma wordt vaak een Stack gebruikt voor het bijhouden van procedure aanroepen en de parameters die worden doorgegeven tussen procedures. Voor elk process bestaat een aantal attributen dat door het besturingssysteem wordt gebruikt voor de besturing ervan. Deze verzameling attributen wordt een Process Control Block (PCB)genoemd. De verzameling die bestaat uit het programma, de gebruikers gegevens, de stack en de attributen het process beeld (process image)

3.3.2 Beheerstructuren van processen Processattributen Een geavanceerd multiprogrammeringsysteem heeft veel informatie over processen nodig. Deze info is in de PCB terug te vinden. We kunnen Informatie in het PCB groeperen tot drie algemene categorieen: Procesidentificatie Processortoestandinformatie processorbesturingsinformatie

Each process is assigned a unique numeric identifier otherwise there must be a mapping that allows the OS to locate the appropriate tables based on the process identifier Many of the tables controlled by the OS may use process identifiers to cross-reference process tables Memory tables may be organized to provide a map of main memory with an indication of which process is assigned to each region similar references will appear in I/O and file tables When processes communicate with one another, the process identifier informs the OS of the destination of a particular communication When processes are allowed to create other processes, identifiers indicate the parent and descendents of each process

Processortoestandinformatie Bestaat uit de inhoud van de processor registers user-visible registers control and status registers stack pointers Program status word (PSW) contains condition codes plus other status information EFLAGS register is an example of a PSW used by any OS running on an x86 processor

X86 EFLAGS Register

Processorbesturingsinformatie/ Dit is de aanvullende informatie die het besturingssyseem nodig heft voor het beheren en coordineren van de diverse actieve processen Forms the 3 rd part of the PCB (along with process ID and processor state information)

Process List Structures

The most important data structure in an OS contains all of the information about a process that is needed by the OS blocks are read and/or modified by virtually every module in the OS defines the state of the OS Difficulty is not access, but protection a bug in a single routine could damage process control blocks, which could destroy the system s ability to manage the affected processes a design change in the structure or semantics of the process control block could affect a number of modules in the OS

3.4.2 Uitvoeringsmodi User Mode Minder gepriviligieerde modes van de processor Gebruikersprogramma worden in deze modus uitgevoerd. System Mode(control mode of kenrel modus) more-privileged mode van de processor also referred to as control mode or kernel mode Verbonden met het besturingssysteem kernel of the operating system

Table 3.7 Standaardfuncties van de kernel van een besturingssysteem

3.4.2 Creeren van processen Once the OS decides to create a new process it: wijst een unieke procesidentificatie toe aan het nieuwe proces Wijst ruimte toe aan het proces Het PCB moet worden geinitialiseerd De juiste koppelingen worden ingesteld Soms moeten andere gegevensstructuren worden gemaakt of uitgebreid

3.4.3 Wisselen van processen Een proceswisseling kan steeds optreden wanneer het besturingssysteem de bestruring heeft overgenomen van het process dat op dit moment wordt uitgevoerd

Interrupt Oorzaak is extern aan de uitvoering van het huidig proces I/O interrupt geheugen fout clock interrupt Time slice the maximum amount of time that a process can execute before being interrupted 3.4.3 Wisselen van processen System Interrupts Trap Hangt samen met een fout of uitzonderingsconditie die wordt gegenereerd binnen het actieve proces zelf, aan de huidige instructie. OS determines if the condition is fatal moved to the Exit state and a process switch occurs action will depend on the nature of the error

If no interrupts are pending the processor: If an interrupt is pending the processor: proceeds to the fetch stage and fetches the next instruction of the current program in the current process sets the program counter to the starting address of an interrupt handler program switches from user mode to kernel mode so that the interrupt processing code may include privileged instructions

A mode switch is distinct from a process switch. A mode switch can take place without changing the state of the executing process However, while processing a mode switch the OS may decide a process switch is needed; e.g., if the mode switch was caused by a timer interrupt or a process request for I/O

The steps in a full process switch are: save the context of the processor update the process control block of the process currently in the Running state move the process control block of this process to the appropriate queue If the currently running process is to be moved to another state (Ready, Blocked, etc.), then the OS must make substantial changes in its environment select another process for execution restore the context of the processor to that which existed at the time the selected process was last switched out update memory management data structures update the process control block of the process selected

Execution of the Operating System

Execution Within User Processes

3.5 Procesbeheer in Unix SVR4 Uses the model where most of the OS executes within the environment of a user process Two process categories: system processes and user processes System processes run in kernel mode executes operating system code to perform administrative and housekeeping functions independent of any specific user process. User Processes operate in user mode to execute user programs and utilities operate in kernel mode to execute instructions that belong to the kernel enter kernel mode by issuing a system call, when an exception is generated, or when an interrupt occurs

UNIX Process States

UNIX Process State Transition Diagram

A Unix Process

Table 3.11 UNIX Process Table Entry

Table 3.12 UNIX U Area

Process creation is by means of the kernel system call, fork( ) This causes the OS, in Kernel Mode, to: 1 2 3 4 Allocate a slot in the process table for the new process Assign a unique process ID to the child process Make a copy of the process image of the parent, with the exception of any shared memory Increments counters for any files owned by the parent, to reflect that an additional process now also owns those files 5 6 Assigns the child process to the Ready to Run state Returns the ID number of the child to the parent process, and a 0 value to the child process

After creating the process the Kernel can do one of the following, as part of the dispatcher routine: stay in the parent process transfer control to the child process transfer control to another process

Summary The most fundamental concept in a modern OS is the process The principal function of the OS is to create, manage, and terminate processes Process control block contains all of the information that is required for the OS to manage the process, including its current state, resources allocated to it, priority, and other relevant data The most important states are Ready, Running and Blocked The running process is the one that is currently being executed by the processor A blocked process is waiting for the completion of some event A running process is interrupted either by an interrupt or by executing a supervisor call to the OS