Operating System Concepts Course Instructor Samra Irshad samra

  • Slides: 42
Download presentation
Operating System Concepts

Operating System Concepts

Course Instructor: Samra Irshad samra. irshad@superior. edu. pk Lecturer CS

Course Instructor: Samra Irshad samra. irshad@superior. edu. pk Lecturer CS

Objective �To develop an understanding of and appreciation for the role of Operating Systems

Objective �To develop an understanding of and appreciation for the role of Operating Systems in Computing Environments 3

 • TEXT Book: �Operating System Concepts by Abraham Silberschatz, Peter B. Galvin and

• TEXT Book: �Operating System Concepts by Abraham Silberschatz, Peter B. Galvin and Greg Gagne • Reference Books: � Operating System: Internals and Design principles by William Stallings. � Operating Systems by Harvey M. Deitel, Paul J. Deitel, David R. Choffnes �No Restriction: Different Books. You can choose the book of your own choice • Web Sites & Material: �will refer you to different web sites and will provide you with different notes if its required. 4

Course requirements �Assignments/Quizes � Written assignments (Small Tasks) (details in coming lectures) � Idea

Course requirements �Assignments/Quizes � Written assignments (Small Tasks) (details in coming lectures) � Idea is to initiate research oriented writing not “cut-copy-paste” � Attendance, Presentations, Quiz & Class Discussion & Participation (as a regular activity) � Volunteer presentations (you must not be that familiar with this kind of stuff but you need to respond to it quickly!) � Formal Presentations in groups

Examination �Every thing discussed, during the class or given as reading material, could be

Examination �Every thing discussed, during the class or given as reading material, could be part of the exams �Questions will be formulated in a way to examine conceptual thinking �Other details will be given close to Sessional

Course Contents �Basic Concepts �Structures and Functions �Process Management �Threads Management �Inter-Process Communication �Synchronization

Course Contents �Basic Concepts �Structures and Functions �Process Management �Threads Management �Inter-Process Communication �Synchronization �Deadlocks �Memory Management �Virtual Memory Management �File Systems �I/O Systems

Chapter 1: Introduction �Basics of Computer Organization and relation with operating systems �What is

Chapter 1: Introduction �Basics of Computer Organization and relation with operating systems �What is an Operating System? �Multi-programmed Systems �Time shared systems �Real -Time Systems �Multiprocessor Systems �Memory Management �Process Management

Lecture 1 Operating System �What is an OPERATING SYSTEM ? �Purpose ? Any raw

Lecture 1 Operating System �What is an OPERATING SYSTEM ? �Purpose ? Any raw idea… ? �Computer System ?

Computer System �Computer System- why do we use it? �Allows you to solve problems

Computer System �Computer System- why do we use it? �Allows you to solve problems �Provides you tools/applications, using those tools you can develop programs which will ultimately solve your needs

Computer System �Computer system is composed of hardware and software �Hardware components that comprise

Computer System �Computer system is composed of hardware and software �Hardware components that comprise the physical entity of device �CPU �RAM �I/O devices

Computer Organization basics �CPU (Central Processing Unit) : Function of this unit ? �‘Executes

Computer Organization basics �CPU (Central Processing Unit) : Function of this unit ? �‘Executes a program’ Contains: �Arithmetic and Logic Unit for manipulating data �A number of registers for storing data �Control circuits for fetching and executing instructions

CPU Cycle �CPU cycle- Fetching, Decoding and Executing �Fetching an instruction- CPU reads an

CPU Cycle �CPU cycle- Fetching, Decoding and Executing �Fetching an instruction- CPU reads an instruction from memory �Decoding an instruction- determining what actions the instruction require �Executing- carrying out those actions

Memory �Where all the programs/data is stored ? �Web browsers, word processor etc… �Initially

Memory �Where all the programs/data is stored ? �Web browsers, word processor etc… �Initially data/program is stored in ‘disk storage’, (also known as ‘secondary memory’). �For a program to run/execute, it must reside in ‘MAIN MEMORY’ (RAM)

Secondary Storage �Secondary Storage- as an extension to main memory �Why not store the

Secondary Storage �Secondary Storage- as an extension to main memory �Why not store the programs and data all at once in main memory ? �Types of storage devices Registers, cache, main memory, electronic disk, magnetic tapes

RAM �RAM: Random Access Memory. . �Why called Random Access Memory ? �Program is

RAM �RAM: Random Access Memory. . �Why called Random Access Memory ? �Program is brought into main memory from secondary storage so that it can be executed �CPU can access ANY location in memory at random and retrieve information within a fixed interval of time

‘Word’ as an entity

‘Word’ as an entity

Execution of a program �Primary purpose of a computer system is to generate executable

Execution of a program �Primary purpose of a computer system is to generate executable programs and execute them. �Following are some of the main issues involved in performing these tasks. ü Storing an executable program on a secondary storage device such as hard disk ü Loading executable from disk into the main memory ü CPU state appropriately so that program execution could begin ü Multiple processes, synchronizing their access to shared data, and allowing them to communicate with each other

I/O devices �I/O devices: Human interaction with the system through Input/output devices �Real-time data

I/O devices �I/O devices: Human interaction with the system through Input/output devices �Real-time data �Computer Organization: the way hardware components operate and the way they are connected together to form a computer system �Hardware components: CPU, Memory and I/O

Motivation for OS �If we have only the computer hardware system, what we can

Motivation for OS �If we have only the computer hardware system, what we can do with it ? �What are things required to make a computer system ‘ACTUALLY’ useful ?

Operating System �A platform/software needed. . Is it so ?

Operating System �A platform/software needed. . Is it so ?

Operating System Basics �Now coming to Operating Systems…. . �Essential part of a computer

Operating System Basics �Now coming to Operating Systems…. . �Essential part of a computer system �Provides services to computer user �To make more effective use of computer �Why do we study it? . . . To get the knowledge of services provided by operating system

�E. g. A high-level language program written by user to solve data-processing tasks is

�E. g. A high-level language program written by user to solve data-processing tasks is an application program while the compiler that translates the program into machine language is task of operating system

Layered Structure

Layered Structure

Multiprogrammed Systems �Several jobs are kept in main memory at the same time, and

Multiprogrammed Systems �Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them.

Multi-programmed Systems �Job pool �Job-scheduling �CPU scheduling

Multi-programmed Systems �Job pool �Job-scheduling �CPU scheduling

OS Features Needed for Multiprogramming �Memory management – the system must allocate the memory

OS Features Needed for Multiprogramming �Memory management – the system must allocate the memory to several jobs. � CPU scheduling – the system must choose among several jobs ready to run.

Time-Sharing Systems- Interactive Computing � Multi-programmed systems did not provide user interaction � The

Time-Sharing Systems- Interactive Computing � Multi-programmed systems did not provide user interaction � The CPU executes multiples jobs by switching among them � Switches occur frequently � Each job is allocated a small portion of CPU time � On-line communication between the user and the system is provided � The CPU is multiplexed among several jobs that are kept in memory and on disk � The CPU is allocated to a job only if the job is in memory � A job is swapped in and out of memory to the disk

Bootstrap program �Bootstrap program: A program whose function is to start the computer software

Bootstrap program �Bootstrap program: A program whose function is to start the computer software operating when the power is turned on. �Loads a portion of OS to main memory and control is then transferred to OS which prepares the computer for general use

Interrupts and Traps �Interrupts- Interrupting the normal execution of processor… Examples ? v Usually

Interrupts and Traps �Interrupts- Interrupting the normal execution of processor… Examples ? v Usually produced by I/O devices v Must be handled by the processor by interrupting execution of the currently running process v Traps- Events produced by execution of certain instructions…. Examples ?

�Load and Store Instructions �Von-neumann Architecture VS Harvard Architecture �Volatile VS Non-volatile

�Load and Store Instructions �Von-neumann Architecture VS Harvard Architecture �Volatile VS Non-volatile

Storage Device Hierarchy

Storage Device Hierarchy

Computer-System Architecture �Single processor systems �Single CPU �Can also include I/O processor e. g.

Computer-System Architecture �Single processor systems �Single CPU �Can also include I/O processor e. g. disk controller processor �Multiprocessors systems Also known as parallel systems, tightly-coupled systems �Advantages include 1. Increased throughput 2. Economy of scale 3. Increased reliability – graceful degradation or fault tolerance

Multi-processing Systems

Multi-processing Systems

Multiprocessor systems �Two types of Multiprocessing: 1. Asymmetric Multiprocessing assigns certain tasks only to

Multiprocessor systems �Two types of Multiprocessing: 1. Asymmetric Multiprocessing assigns certain tasks only to certain processors, Master-slave concept… Master processor schedules and allocates work to the slave processors 1. Symmetric Multiprocessing - treats all of the processing elements in the system identically Key role – the scheduler

Real-Time Systems n When given an input, O/P must respond in a very well-

Real-Time Systems n When given an input, O/P must respond in a very well- defined period of time n Often used as a control device in a dedicated application such as controlling scientific experiments, medical imaging systems, industrial control systems, and some display systems. n Real-Time systems may be either hard (guarantees that critical tasks be completed on time, if not then catastrophe may happen) or soft real-time (no fear of catastrophe)

Operating System- A Resource Manager �Resource Manager: Resources- CPU, Memory and I/O

Operating System- A Resource Manager �Resource Manager: Resources- CPU, Memory and I/O

Secondary Storage Management Manage secondary storage devices ØAllocate appropriate amount of disk space when

Secondary Storage Management Manage secondary storage devices ØAllocate appropriate amount of disk space when files are created ØDe-allocate space when files are removed ØEnsure that a new file does not overwrite an existing file

Main Memory Management Manage primary storage (main memory) �Allocate appropriate amount of memory space

Main Memory Management Manage primary storage (main memory) �Allocate appropriate amount of memory space when programs are to be loaded into the memory for execution �De-allocate space when processes terminate �Ensure that a new program is not loaded on an existing program �Minimize the amount of unused memory space �Allow execution of programs larger in size than the available main memory Virtual Memory

Processes �A program in execution is called a process �Single-user and Multiple users �In

Processes �A program in execution is called a process �Single-user and Multiple users �In case of multiple processes, how the CPU will be allocated to those evenly ? �Some processes getting maximum of CPU time while others are being allocated less ? �CPU-time scheduling

Process Management v. Manage processes Allow simultaneous execution of processes by scheduling the CPU

Process Management v. Manage processes Allow simultaneous execution of processes by scheduling the CPU �Prevent deadlocks between processes �Ensure integrity of shared data �Synchronize executions of cooperating processes

References �Operating System Concepts by Silberschatz (7 th edition) �Computer System Architecture by Morris

References �Operating System Concepts by Silberschatz (7 th edition) �Computer System Architecture by Morris Mano (3 rd edition)