1 Unix Architecture. 2 Operating Systems Concepts 1. Process 2. Memory management 3. Information protection & security 4. Scheduling and resource management.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
Review: Operating System Manages all system resources ALU Memory I/O Files Objectives: Security Efficiency Convenience.
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
CMPT 300: Operating Systems I Ch 3: Processes Dr. Mohamed Hefeeda
Process Concept n An operating system executes a variety of programs: –Batch system – jobs –Time-shared systems – user programs or tasks n Textbook uses.
1 Scheduling in Representative Operating Systems.
1 Uniprocessor Scheduling Chapter 9. 2 Aims of Scheduling Assign processes to be executed by the processor(s) Response time Throughput Processor efficiency.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Operating System Concepts
Process Concept An operating system executes a variety of programs
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
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.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Process Description and Control
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Main Job: Assign processes to be executed by the processor(s) and processes to be loaded in main.
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.
Silberschatz and Galvin  Operating System Concepts Module 4: Processes Process Concept Process Scheduling Operation on Processes Cooperating.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Operating Systems Part III: Process Management (Process States and Transitions)
Operating Systems Chapter 2
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Assistant Professor, University of Maryland Baltimore County.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 4 Process Slide 1 Chapter 4 Process.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Threads G.Anuradha (Reference : William Stallings)
8-Sep Operating Systems Yasir Kiani. 8-Sep Agenda for Today Review of previous lecture Process scheduling concepts Process creation and termination.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Processes – Part I Processes – Part I. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Review on OSs Upon brief introduction of OSs,
11/13/20151 Processes ICS 240: Operating Systems –William Albritton Information and Computer Sciences Department at Leeward Community College –Original.
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Response time Throughput Processor efficiency.
Processes and Process Control 1. Processes and Process Control 2. Definitions of a Process 3. Systems state vs. Process State 4. A 2 State Process Model.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Silberschatz, Galvin and Gagne  Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system.
Traditional UNIX Scheduling Scheduling algorithm objectives Provide good response time for interactive users Ensure that low-priority background jobs do.
Processes Dr. Yingwu Zhu. Process Concept Process – a program in execution – What is not a process? -- program on a disk - a process is an active object,
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
1 OS Review Processes and Threads Chi Zhang
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator –Control program.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
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,
Processes and threads.
Process Management Process Concept Why only the global variables?
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Process Management Presented By Aditya Gupta Assistant Professor
Chapter 3: Processes.
Uniprocessor Scheduling
Chapter 3: Processes.
Lecture 2: Processes Part 1
Operating Systems Lecture 6.
Process & its States Lecture 5.
Mid Term review CSC345.
Chapter 3: Processes.
Lecture Topics: 11/1 General Operating System Concepts Processes
Chapter 3: Processes.
Chapter 3: Processes Process Concept Process Scheduling
Presentation transcript:

1 Unix Architecture

2 Operating Systems Concepts 1. Process 2. Memory management 3. Information protection & security 4. Scheduling and resource management 5. The Shell

3 System Structure – UNIX UNIX – The kernel Consists of everything below the system-call interface and above the physical hardware Provides the file system, CPU scheduling, memory management, and other operating- system functions.

4 Process Concept Process – a program in execution UNIX’s process definition: “an address space with one or more threads executing within that address space, and the required system resources for those threads.” A process includes: program counter stack data section

5 Process State As a process executes, it changes state new: The process is being created. running: Instructions are being executed. waiting: The process is waiting for some event to occur. ready: The process is waiting to be assigned to a process. terminated: The process has finished execution.

6 Process Control Block (PCB) Information associated with each process. Process state Program counter CPU registers CPU scheduling information Memory-management information Accounting information I/O status information

7 Context Switch 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.

8 Some of the Process Scheduling Queues Job queue – set of all processes in the system. Ready queue – set of all processes residing in main memory, ready and waiting to execute. Device queues – set of processes waiting for an I/O device. Process migration between the various queues.

9 Schedulers Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue. Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU.

10 Process Creation Parent process creates children processes, which, in turn create other processes, forming a tree of processes. Execution Parent and children execute concurrently. Parent waits until children terminate.

11 Signals A signal is an event generated by the UNIX system in response to some condition: Errors - memory violations, math processors errors Interrupt Calling to kill system call

12 Threads (briefly) A thread (or lightweight process) is consists of: program counter register set stack space A thread shares with its peer threads its: code section data section operating-system resources A traditional or heavyweight process is equal to a task with one thread

13 Threads Support in Solaris 2 Solaris 2 is a version of UNIX with support for threads at the kernel and user levels, symmetric multiprocessing, and real-time scheduling. LWP – intermediate level between user-level threads and kernel-level threads. Resource needs of thread types: Kernel thread: small data structure and a stack; thread switching does not require changing memory access information – relatively fast. LWP: PCB with register data, accounting and memory information,; switching between LWPs is relatively slow. User-level thread: only need stack and program counter; no kernel involvement means fast switching. Kernel only sees the LWPs that support user-level threads.

14 Solaris 2 Threads

15 Interprocess Communication (IPC) I/O Pipes Shared memory Message Passing

16 I/O System Calls I/O operations made by descriptors Descriptors are integer values represent indexes for special tables that are handle by the OS kernel to access the data – (a file can be a device also) Every process has his own descriptors, saved in his PDT – process descriptor table By default, every process has 3 descriptors: 0 – stdin - keyboard 1 – stdout - screen 2 – stderr - screen

17 Pipes FIFO data passing Can use for synchronization Implement via files by two descriptors (read, write) Pipe types: Named pipe Unnamed pipes

18 The File System

19 File Attributes Name – only information kept in human-readable form. Type – needed for systems that support different types. Location – pointer to file location on device. Size – current file size. Protection – controls who can do reading, writing, executing. Time, date, and user identification – data for protection, security, and usage monitoring. Information about files are kept in the directory structure, which is maintained on the disk.

20 Access Lists and Groups Mode of access: read, write, execute Three classes of users RWX a) owner access 7  RWX b) groups access 6  RWX c) public access1  Attach a group to a file chgrp G game owner group public chmod761game

21 In-Memory File System Structures

22 Indexed Allocation Brings all pointers together into the index block. index table

23 Example of Indexed Allocation

24 Indexed Allocation (Cont.) Need index table Random access have overhead of index block. Mapping from logical to physical in a file of maximum size of 256K words and block size of 512 words. We need only 1 block for index table.

25 UNIX inode (UFS)

26 Disk Partition Booting the operating system Primary Boot Sector (sector 0) – MBR and Partition Table – allocate the active partition and jump to it’s secondary boot sector Active Partition – the loader of the OS is in the secondary boot sector – set the OS file system inactive partition – the secondary boot sector is ignored – additional file system

27 Disk Formatting and Partitioning Disk Partitioning MS-DOS /Linux – fdisk MS-DOS partitions can mount as separate drives Linux – one partition for root file system and one for swap file system Disk Formatting Setup the partition with the file system structure MS-DOS format – bootstrap code, FAT, root directory UNIX mkfs – bootstrap code,super block, i-nodes

28 UNIX

29 UNIX

30 UNIX

31 UNIX i-node structure is small, fixed size Smaller files can be accessed quickly – larger files longer How big can a file be ? Assume 1K disk block and 32 bit address 10Kb * 1K + 256*256*1K + 256*256*256*1K > 16GB

32 UNIX

33 Traditional UNIX Scheduling Scheduling algorithm objectives Provide good response time for interactive users Ensure that low-priority background jobs do not starve Scheduling algorithm implementation Multilevel feedback using round robin within each of the priority queues 1 second preemption Priority based on process type and execution history Priorities are recomputed once per second Base priority divides all processes into fixed bands of priority levels Bands used to optimize access to block devices (e.g., disk) and to allow the OS to respond quickly to system calls

34 Traditional UNIX Scheduling (cont.) CPU j (i) = Measure of processor utilization by process j through interval i P j ( i ) = Priority of process j at beginning of interval i ; lower values equal higher priorities Base j =Base priority of process j nice j =User controllable adjustment factor CPU j ( i – 1) P j (i) = Base j + 2 CPU j ( i – 1) 2 CPU j (i) = + nice j

35 Traditional UNIX Scheduling (cont.) Bands in decreasing order of priority Swapper Block I/O device control File manipulation Character I/O device control User processes Goals Provide the most efficient use of I/O devices Within the user process band, use the execution history to penalize processor-bound processes at the expense of I/O bound processes Example of process scheduling Processes A, B, and C are created at the same time with base priorities of 60 Clock interrupts the system 60 times a second and increments counter for running process

36 Traditional UNIX Scheduling (Example)

37 Linux Scheduling Enhances the traditional UNIX scheduling by adding two new scheduling classes for real- time processing Scheduling classes SCHED_FIFO: First-in-first-out real-time threads SCHED_RR: Round-robin real-time threads SCHED_OTHER: Other, non-real-time threads

38 Linux Scheduling: FIFO vs. RR