Operating System Concept

Slides:



Advertisements
Similar presentations
Chap 4 Multithreaded Programming. Thread A thread is a basic unit of CPU utilization It comprises a thread ID, a program counter, a register set and a.
Advertisements

Chapter 4: Multithreaded Programming
Processes CSCI 444/544 Operating Systems Fall 2008.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
3.5 Interprocess Communication
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Process Concept An operating system executes a variety of programs
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 4: Threads.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Silberschatz, Galvin and Gagne ©2011Operating System Concepts Essentials – 8 th Edition Chapter 4: Threads.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Operating System Concepts Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
Multithreaded Programing. Outline Overview of threads Threads Multithreaded Models  Many-to-One  One-to-One  Many-to-Many Thread Libraries  Pthread.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 14 Threads 2 Read Ch.
Chapter 4: Multithreaded Programming. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts What is Thread “Thread is a part of a program.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
Operating System Concepts
Lecturer 3: Processes multithreaded Operating System Concepts Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads  Overview  Multithreading Models  Threading Issues  Pthreads.
Contents 1.Overview 2.Multithreading Model 3.Thread Libraries 4.Threading Issues 5.Operating-system Example 2 OS Lab Sun Suk Kim.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Operating System Components) These components reflect the services made available by the O.S. Process Management Memory Management I/O Device Management.
OPERATING SYSTEM CONCEPT AND PRACTISE
Chapter 4: Threads.
Processes and threads.
Process Management Process Concept Why only the global variables?
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Operating System Concepts
Operating Systems (CS 340 D)
OPERATING SYSTEMS CS3502 Fall 2017
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Operating System Concepts 7th Edition Abraham SilBerschatz Peter Baer Galvin Greg Gagne Prerequisite: CSE212.
Chapter 3 Threads and Multithreading
Chapter 4: Multithreaded Programming
Process Management Presented By Aditya Gupta Assistant Professor
Chapter 3: Process Concept
Chapter 3: Processes.
Intro to Processes CSSE 332 Operating Systems
Operating Systems (CS 340 D)
Chapter 4: Threads.
Threads & multithreading
Operating System Concepts
Chapter 3: Processes.
Operating Systems Processes and Threads.
Chapter 4: Threads.
Chapter 4: Threads.
Lecture 2: Processes Part 1
Operating System Concepts
OPERATING SYSTEMS Threads
Modified by H. Schulzrinne 02/15/10 Chapter 4: Threads.
Process & its States Lecture 5.
Mid Term review CSC345.
Chapter 4: Threads.
Chapter 3: Processes.
Operating System Concepts
Chapter 4: Threads.
Multithreaded Programming
Chapter 3: Processes.
Chapter 4: Threads.
Chapter 4: Threads.
Chapter 4: Threads.
Chapter 4: Threads.
Operating System Overview
Chapter 4: Threads.
Chapter 3: Process Management
Chapter 4:Threads Book: Operating System Principles , 9th Edition , Abraham Silberschatz, Peter Baer Galvin, Greg Gagne.
Presentation transcript:

Operating System Concept Chapter I Designed by .VAS

What is OS ? An operating system is a program that manages the Computer Hardware . Functions : Resource Allocation & Related Function User Interface function

The Four Components Hardware OS Application Program User

SYSTEM Mainframe Systems For commercial & Scientific Application Batch Systems – Similar kind of program collect into single batch for processing .

Multiprogrammed Systems It increases CPU utilization by organizing jobs so that the CPU always has one to execute.

Time-Sharing Systems Time sharing (or multitasking) is a logical extension of multiprogramming. User interaction with the computer system. A time-shared operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of a time-shared computer.

Desktop Systems Personal computers PCs appeared in the 1970s. Used for maximizing user convenience and responsiveness , instead of maximizing CPU and peripheral utilization. Include PCs running Microsoft Windows and the Apple Macintosh.

Multiprocessor Systems Most systems to date are single-processor systems . Multiprocessor systems (also known as parallel systems or tightly coupled systems) are growing in importance. Such systems have more than one processor Advantages : - Increased throughput Economy of scale Increased reliability

Distributed Systems A network, in the simplest terms, is a communication path between two or more systems. Distributed systems depend on networking for their functionality. LAN , WAN , MAN

Modern Computer System

Process Management Program in execution . Process Needs CPU time, Memory, Files I/O devices

Activities in Process Mgmt. Creating and deleting both User and System processes Suspending and resuming processes Providing mechanisms for process synchronization Providing mechanisms for process communication Providing mechanisms for deadlock handling.

I/O Structure CPU and multiple device controllers that are connected through a common bus . Small Computer-Systems Interface (SCSI). Controller can have seven or more devices attached to it. Device controller is responsible for moving the data between the peripheral devices that it controls and its local buffer storage.

I/O Interrupts To start an I/O operation , CPU loads the appropriate registers within the Device controller. Device controller examines the contents of these registers to determine what action to take . If read request found , controller will start the transfer of data from the device to its local buffer .

I/O Interrupts ( cont..) Courses of action :- After transfer of data is complete . Device controller informs the CPU . It accomplishes this communication by triggering an interrupt. Courses of action :- synchronous I/O. asynchronus I/O

Two I/O Methods

DMA ( Direct Memory Access ) Used for high-speed I/O devices. Device controller transfers an entire block of data directly to or from its own buffer storage to memory . No intervention by the CPU . Interrupt is generated per block, rather than the one interrupt per byte . The DMA controller interrupts the CPU when the transfer has been completed.

PROGRAM INPUT/ OUTPUT

Storage Structure Computer programs must be in main memory (also called random-access memory or RAM) to be executed. Semiconductor technology called dynamic random-access memory (DRAM) . CPU automatically loads instructions from main memory for execution.

Storage device hierarchy

Process Concept Process is a program in execution . Process State Process Control Block Process Scheduling

Process State New: The process is being created. Running: Instructions are being executed. Waiting: The process is waiting for some event to occur (such as an I/O completion or reception of a signal). Ready: The process is waiting to be assigned to a processor. Terminated: The process has finished execution.

PS . Cont

Process Control Block

PCB . Cont.. Process state: The state may be new, ready, running, waiting, halted, and So on Program counter: The counter indicates the address of the next instruction to be executed for this process. CPU registers: The registers vary in number and type, depending on the computer architecture. They include accumulators, index registers, stack pointers, and general-purpose registers .

Process Scheduling Scheduling Queues :- processes enter the system, they are put into a job queue . The processes that are residing in main memory and are ready and waiting to execute are kept on a list called the ready queue. Ready-queue header contains pointers to the first and final PCBs in the list.

The ready queue and various I/O device queues

Queuing-diagram representation of process scheduling

Process Scheduling cont… Schedulers - process migrates between the various scheduling queues throughout its lifetime. Long term Scheduler - Selects processes from this pool and loads them into memory . Short term Scheduler - Selects from among the processes that are ready to execute, and allocates the CPU to one of them.

Addition of medium-term scheduling to the queuing diagram.

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.

Operations on Processes Process Creation - process may create several new processes, via a create-process system call, during the course of execution. Process Termination - process terminates when it finishes executing its final statement and asks the operating system to delete it by using the exit system call.

a tree processes on typical Unix system

Cooperating Processes Process is cooperating if it can affect or be affected by the other processes executing in the system. Several Reasons for allowing Cooperating process – Information sharing Computation speedup Modularity Convenience

Threads It is LWP – Light Weight Process . Basic unit of CPU utilization . Thread ID, Program counter, Register set, and Stack. A traditional (or heavyweight) process has a single thread of control. If process has multiple threads of control, it can do more than one task at a time.

Single Thread / Multi Thread

Play a vital role in remote procedure call (RPC) systems Example of MT. web browser word processor Problem of ST . Web Server – Services to Client Play a vital role in remote procedure call (RPC) systems

Benefits of MT. Responsiveness - Resource sharing – Multithreading an interactive application may allow a program to continue running even if part of it is blocked or is performing a lengthy operation . Resource sharing – Threads share the memory and the resources of the process to which they belong.

Benefits of MT Cont . . . Economy – Allocating memory and resources for process creation is costly. Alternatively, because threads share resources of the process to which they belong, it is more economical to create and context switch threads. Utilization of multiprocessor architectures – Increased in a multiprocessor architecture, where each thread may be running in parallel on a different processor.

Levels of MT user threads – kernel threads – Supported above the kernel and are implemented by a thread library at the user level kernel threads – Supported directly by the operating system: The kernel performs thread creation, scheduling, and management in kernel space.

Multi Threading Models Many-to-One Model Thread management is done in user space, so it is efficient, but the entire process will block if a thread makes a blocking system call

MTM Cont .. One-to-one Model One-to-one model maps each user thread to a kernel thread. It provides more concurrency than the many-to-one model by allowing another thread to run when a thread makes a blocking system call;

MTM Cont .. Many-to-Many Model Many-to-many model multiplexes many user-level threads to a smaller or equal number of kernel threads.

Threading Issues Fork-EXEC is a commonly used technique in Unix / Linux whereby an executing process spawns a new program. fork() is the name of the system call that the parent process uses to "divide" itself ("fork" into two identical processes).

Threading Issue … Cancellation – 1. Asynchronous cancellation: One thread immediately terminates the target thread. 2. Deferred cancellation: The target thread can periodically check if it should terminate, allowing the target thread an opportunity to terminate itself in an orderly fashion.

Threading Issue … Signal Handling 1. A signal is generated by the occurrence of a particular event. 2. A generated signal is delivered to a process. 3. Once delivered, the signal must be handled.

Threading Issue … Signal Handler 1. A default signal handler Default signal handler that is run by the kernel when handling the signal. 2. A user-defined signal handler User-defined function is called to handle the signal rather than the default action.

Problem for responding client. Web Server Problem – Multiple request handling. Unlimited threads could exhaust system resources, such as CPU time or memory. Thread Pools (TP) TP Create a number of threads at process startup and place them into a pool , where they sit and wait for work. Server receives a request, it awakens a thread from this pool-if one is available-passing it the request to service

TP Cont.…. Once the thread completes its service, it returns to the pool awaiting more work . If the pool contains no available thread, the server waits until one becomes free.

Thread-Specific Data Threads belonging to a process share the data of the process. Each thread might need its own copy of certain data in future . Call such data thread-specific data. Assigning Unique Identifier to each transaction and associate UID to each thread.

P -Thread POSIX - Portable Operating System Interface . Defining an API for thread creation and synchronization.

Working of OS

Working of NOS

Thank You . . . Any