Process Management Process Concept Why only the global variables?

Slides:



Advertisements
Similar presentations
Processes Management.
Advertisements

Chapter 3 Process Description and Control
Processes CSCI 444/544 Operating Systems Fall 2008.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
CSSE Operating Systems
CSE451 Processes Spring 2001 Gary Kimura Lecture #4 April 2, 2001.
Process Concept An operating system executes a variety of programs
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
Process Description and Control A process is sometimes called a task, it is a program in execution.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
CE Operating Systems Lecture 5 Processes. Overview of lecture In this lecture we will be looking at What is a process? Structure of a process Process.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Introduction to Processes CS Intoduction to Operating Systems.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
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.
Multiprogramming. Readings r Silberschatz, Galvin, Gagne, “Operating System Concepts”, 8 th edition: Chapter 3.1, 3.2.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
8-Sep Operating Systems Yasir Kiani. 8-Sep Agenda for Today Review of previous lecture Process scheduling concepts Process creation and termination.
Computer Studies (AL) Operating System Process Management - Process.
Processes – Part I Processes – Part I. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Review on OSs Upon brief introduction of OSs,
Silberschatz, Galvin and Gagne  Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
1  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Process Control Management Prepared by: Dhason Operating Systems.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Operating System Components) These components reflect the services made available by the O.S. Process Management Memory Management I/O Device Management.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Processes and threads.
Process concept.
Chapter 3: Processes.
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Operating System Concepts
Operating Systems (CS 340 D)
Sujata Ray Dey Maheshtala College Computer Science Department
OPERATING SYSTEMS CS3502 Fall 2017
Lecture Topics: 11/1 Processes Process Management
Process Management Presented By Aditya Gupta Assistant Professor
Chapter 3: Processes.
Processes A process is a running program.
Intro to Processes CSSE 332 Operating Systems
Operating Systems (CS 340 D)
Chapter 3: Processes.
Process Virtualization. Process Process is a program that has initiated its execution. A program is a passive entity; whereas a process is an active entity.
Structure of Processes
Lecture 2: Processes Part 1
Operating Systems Lecture 6.
Process & its States Lecture 5.
Chapter 3: Processes.
Operating System Concepts
Process Description and Control
Process Description and Control
Processes Hank Levy 1.
Sujata Ray Dey Maheshtala College Computer Science Department
Processes and Process Management
Chapter 3: Processes.
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
CS510 Operating System Foundations
Process.
Processes Hank Levy 1.
Chapter 3: Processes Process Concept Process Scheduling
Chapter 3: Process Management
Presentation transcript:

Process Management Process Concept Why only the global variables? Why only the descriptors? The local variables are kept in the stack. The files could be large and not fit into the memory or any buffer. So only the file’s current status is kept (pointer to the file’s block, file handle, buffer’s address, …

Many processes in the same RAM Address Space - A group of memory addresses used by something (process, module,…) How many different address spaces we see in the RAM?

PIDs Process Tree Most operating systems identify processes according to a unique process identifier (or pid). The pid can be used as an index to access various attributes of a process within the kernel. During the course of execution, a process may create several new processes. The creating process is called a parent process the new processes are called the children of that process. Each of these new processes may in turn create other processes, forming a tree of processes. The init process (which always has a pid of 1) serves as the root parent process for all user processes.

Process Table To keep track of the state of all the processes, the operating system maintains a table known as the process table. Inside this table, every process is listed along with the resources the process is using and the current state of the process.

Looking at the Process Tree

Another Look at the Process Tree

Process Control Block PCB, TCB PCB is the repository of process. Everything about the processes in the system is kept in PCBs PCB is a container of the Process Context If the OS kernel supports threads then the system could manage also TCBs. The whole PCB collection is called Process Table. PCB contains many pieces of information associated with a specific process

PCB content Pointer to the next PCB i.e. pointer to the PCB of the next process to run. Process state: The state may be new, ready, running, waiting, halted, and so on. Process number: The identifier of the process (PID). Program counter: The counter indicates the address of the next instruction to be executed for this process. Pointer to next PCB CPU registers: The registers vary in number and type, depending on the computer architecture. They include: Accumulators index registers stack pointers general-purpose registers any condition-code information. Along with the program counter, this state information must be saved when an interrupt occurs, to allow the process to be continued correctly afterward.

PCB content Memory-management information: The memory translation map. the value of the base and limit registers the page tables the segment tables CPU-scheduling information: process priority pointers to scheduling queues and any other scheduling parameters. Process accounting information such as when the process was last run how much CPU and real time it has accumulated time limits. I/O Information I/O devices allocated to this process list of opened files, etc Pointer to next PCB

Process Scheduling The responsibility of determining how to allocate processor time among all the ready processes is known as scheduling (CPU time scheduling). The objective of multiprogramming is to have some process running at all times, so as to maximize CPU utilization. The objective of time-sharing is to switch the CPU among processes so frequently that users can interact with each program while it is running. A uniprocessor system can have only one running process. If more processes exist, the rest must wait until the CPU is free and can be rescheduled.

Process States Waiting: wait for some event to occur such as an I/O completion or reception of a signal. Ready: The process is waiting for permission to use the CPU. waiting and ready states are implemented as queues which hold the processes in these states Terminated: The process has finished execution. New: The process is being created. Running: Instructions are being executed on CPU. process has all the resources it needs for execution Only one process can be in the running state at any given time http://courses.cs.vt.edu/~csonline/OS/Lessons/Processes/index.html

Process States on Unix %CPU The task's share of the CPU time expressed as a percentage of total CPU time. %MEM The task's share of the physical memory. VSZ The total amount of virtual memory used by the task in kilobytes. RSS The total amount of physical memory used by the task in kilobytes. START start time of task. STAT The process state.

Process States on Unix PROCESS STATE CODES D - uninterruptible (unkillable) sleep (usually I/O processes) – waiting queue R - runnable - these processes now are working – ready queue S - sleeping - these processes are not running but they are active and wait to serve requests –waiting queue T - traced or stopped Z - a defunct ("zombie") process - this process tried to die, partially is dead but its name exists in process list

Scheduling Queues Two types of queues are present: the ready queue and a waiting queue. The waiting queue could be represented as a set of device queues. The list of processes waiting for a particular I/O device is called a device queue. Each device has its own device queue.

Another view how the processes are put on different queues

Processes leaving CPU Who invokes the I/O request? Blocking I/O Call Once the process is assigned to the CPU and is executing, one of several events could occur: The process could issue an I/O request, and then be placed in an I/O queue. The process could create a new subprocess and wait for its termination. The process could be removed forcibly from the CPU, as a result of an interrupt, and be put back in the ready queue. Who invokes the I/O request? Blocking I/O Call Non Blocking I/O call ? Who invokes fork? Blocking Fork Non Blocking Fork ? Where is the child ? Child Wait Interrupt ? Parent New process arrived I/O of other process is finished

Concurrent and parallel processes Parallelism is when the processes run simultaneously. Concurrent processes could run simultaneously or interleaving What is the main problem of concurrency and how it’s resolved ? The hardware is single. Solution: Multiplex the processes in time on the same hardware Make illusion of multiple CPUs each of which is dedicated for the appropriate process. All non CPU resources (I/O devices and memory) are shared by virtual CPUs I/O Devices

Multiprogramming vs. Multiprocessing Parallelism ? Concurrency ? Batch Processing Multiprogrmming Why some tasks take longer to run? Time Sharing Will the process leave CPU before time slice expires?

Context Switch Switching the CPU to another process requires: saving the state of the old process and loading the saved state for the new process. This task is known as a context switch. PCBs are loaded. New translation map is loaded Context-switch time is pure overhead because the system does no useful work while switching

Stack push example on x86 assembly