The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)

Slides:



Advertisements
Similar presentations
Chapter 3 Process Description and Control
Advertisements

Day 11 Processes. Operating Systems Control Tables.
Process Description and Control Module 1.0. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Process Description and Control Chapter 3. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Processes CSCI 444/544 Operating Systems Fall 2008.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Structure of Processes
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Introduction to Kernel
1 Process Description and Control Chapter 3. 2 Process Management—Fundamental task of an OS The OS is responsible for: Allocation of resources to processes.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
CSCE 351: Operating System Kernels
OS Spring’03 Introduction Operating Systems Spring 2003.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
Computer Organization and Architecture
Processes and Resources
CSSE Operating Systems
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
Using Two Queues. Using Multiple Queues Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Processor is faster.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Computer Organization and Architecture Operating System Support Chapter 8.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Protection and the Kernel: Mode, Space, and Context.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
Exec Function calls Used to begin a processes execution. Accomplished by overwriting process imaged of caller with that of called. Several flavors, use.
Chapter 3 Process Description and Control
The Structure of Processes. What is a Process? an instance of running program Program vs process(task) Program : just a passive collection of instructions.
Operating Systems 1 K. Salah Module 2.0: Processes Process Concept Trace of Processes Process Context Context Switching Threads –ULT –KLT.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
1 Linux Operating System 許 富 皓. 2 Memory Addressing.
Process by Dr. Amin Danial Asham. References Operating System Concepts ABRAHAM SILBERSCHATZ, PETER BAER GALVIN, and GREG GAGNE.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Chapter 4 Memory Management Virtual Memory.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Silberschatz, Galvin and Gagne  Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
1 Structure of Processes Chapter 6 Process State and Transition Data Structure for Process Layout of System Memory THE DESIGN OF THE UNIX OPERATING SYSTEM.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
What is a Process ? A program in execution.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Introduction to Kernel
Processes and threads.
Process concept.
Operating Systems CMPSC 473
Process Management Process Concept Why only the global variables?
Structure of Processes
Process Realization In OS
Intro to Processes CSSE 332 Operating Systems
Structure of Processes
More examples How many processes does this piece of code create?
Process Description and Control
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Processes in Unix and Windows
CS510 Operating System Foundations
Process Description and Control in Unix
Process Description and Control in Unix
Structure of Processes
Presentation transcript:

The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)

Contents Process States and Transitions Process table and u area Context of a process User-level context Register context System-level context 2

process an instance of running program Program vs process Program : just a passive collection of instructions Process : actual execution of the instructions Several processes may be associated with one program In addition to program code, necessary resources (memory, CPU, etc) are allocated to process 3

Process States and Transitions Lifetime of a process 4

Process State Transition Diagram in UNIX 5

CPU execution mode place restrictions on the operations that can be performed by the process currently running in the CPU Kernel mode When the CPU is in kernel mode, it is assumed to be executing trusted software, and thus it can execute any instructions and reference any memory addresses (i.e., locations in memory). The kernel (which is the core of the operating system and has complete control over everything that occurs in the system) is trusted software, but all other programs are considered untrusted software. User mode It is a non-privileged mode in which each process (i.e., a running instance of a program) starts out. It is non-privileged in that it is forbidden for processes in this mode to access those portions of memory (i.e., RAM) that have been allocated to the kernel or to other programs.

PCB (Process Control Block) Contain process-related information (e.g. which resources allocated to a process in what state. Largely three parts proc table u area Text table For code sharing (e.g. vi, shell, …) 7

Process (proc) table and u area Kernel data structures Describes the state of a process Process table Always accessible to the kernel. U area Accessible only to the running process Generally, much bigger than proc table Swappable vs non-swappable 8

Fields in proc table Process ID Process state Pointers to process (code) and its u area User ID Scheduling parameters (priority, CPU utilization,…) Signal field Signals not yet handled (pending delivery) Various timers Execution time, resource utilization, scheduling priority 9

Fields in u area Pointer to process table entry Real and effective user IDs Timers – time the process spent executing An array for the process to react to signals Control terminal – if one exists Error field, return value – system call I/O parameters (file offsets for I/O, data amount to transfer, …) Current directory, current root User file descriptor table Limits – process, file size Permission – used on creating the process 10

Layout of System Memory Physical address space impossible for two processes to execute concurrently if their set of generated addresses overlapped. Virtual address space Allows many processes to share finite amount of physical memory Each process uses the same virtual addresses but reference different physical addresses Requires mechanism for translating virtual address to physical address 11

Regions Region (similar to segment) Contiguous area of virtual address space of a process that can be treated as a distinct object to be shared or protected. Virtual address space of a process is divided into logical regions Text : a set of instructions Data : (initialized & uninitialized) data variables Stack : data structures local to a subroutine 12

Pregion (per process region table) Each pregion entry points to starting virtual address of region in the process. Can exist in proc table or u area Shared region may have different virtual address in each process 13

Process context Each time a process is removed from access to CPU, sufficient information on its current operating state must be stored such that when it is again scheduled to run on the processor it can resume its operation from an identical position. This operational state data is known as its context Context switch the act of replacing a process to another for execution 14

Context of a process consists of its (user) address space, hardware registers and kernel data structures that relate to the process User-level context Register context System-level context 15

Process Context argc, argv env. variables stack heap Uninitialized data Initialized data text (code) memory mapping tables text table proc table u area kernel stack PC (prog counter) SP (stack pointer) register User level context System-level context Register context

User-level context Process text, data, user stack, and shared memory Parts of the virtual address space of a process periodically do not reside in main memory because of swapping. 17

Register context Program counter (PC) process status (PS) register (e.g. overflowed?) stack pointer (SP) general-purpose registers 18

System-level context PTE (proc table entry) u area Region table Kernel stack system-level context layer Contains necessary information to recover the previous layer 19

Components of the process context 20