L1Introductionf

Page 1

ef:

Chapter 1: Introduction

Operating System Concepts with Java – 7 th Edition,

Prof. Dr. Hanafy Ismail


Chapter 1: Introduction        

What Operating Systems Do Computer-System structure Operating-System Structure Operating-System Operations Process Management Memory Management Storage Management Protection and Security

Ref: Operating System Concepts with Java – 7 th Edition

1.2

Prof. Dr. Hanafy Ismail


What is an Operating System do?  

A program that acts as an intermediary between a user of a computer and the computer hardware. Operating system main purposes:  Provide an environment for a computer user to execute programs on computer hardware in a convenient and efficient manner.  To allocate the separate resources of the computer as needed to solve the problem given. The allocation process should be as fair and efficient as possible.  As a control program it serves two functions:  Supervision of user programs to prevent errors and improper use of the computer.  Management of the operation and control of I/O devices.

Ref: Operating System Concepts with Java – 7 th Edition

1.3

Prof. Dr. Hanafy Ismail


Computer System Structure 

Computer system can be divided into four components  Hardware – provides basic computing resources  CPU, memory, I/O devices  Application programs – define the ways in which the system resources are used to solve the computing problems of the users  Word processors, compilers, web browsers, database systems, video games  Operating system  Controls and coordinates use of hardware among various applications and users  Users  People, machines, other computers

Ref: Operating System Concepts with Java – 7 th Edition

1.4

Prof. Dr. Hanafy Ismail


Four Components of a Computer System

Ref: Operating System Concepts with Java – 7 th Edition

1.5

Prof. Dr. Hanafy Ismail


Operating System Definition 

OS is a resource allocator  Manages all resources  Decides between conflicting requests for efficient and fair resource use OS is a control program  Controls execution of programs to prevent errors and improper use of the computer

Ref: Operating System Concepts with Java – 7 th Edition

1.6

Prof. Dr. Hanafy Ismail


Operating System Definition (Cont.)  

No universally accepted definition “Everything a vendor ships when you order an operating system” is good approximation  But varies wildly “The one program running at all times on the computer” is the kernel. Everything else is either a system program (ships with the operating system) or an application program

Ref: Operating System Concepts with Java – 7 th Edition

1.7

Prof. Dr. Hanafy Ismail


Computer System Organization  

One or more CPUs, device controllers connect through common bus providing access to shared memory Concurrent execution of CPUs and devices competing for memory cycles. The memory controller provides synchronize access to the memory

Ref: Operating System Concepts with Java – 7 th Edition

1.8

Prof. Dr. Hanafy Ismail


Computer-System Operation      

I/O devices and the CPU can execute concurrently. Each device controller is in charge of a particular device type. Each device controller has a local buffer. CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller. Device controller informs CPU that it has finished its operation by causing an interrupt.

Ref: Operating System Concepts with Java – 7 th Edition

1.9

Prof. Dr. Hanafy Ismail


Computer Startup 

bootstrap program is loaded at power-up or reboot

Typically stored in ROM or EPROM (Erasable Programmable Read-Only Memory) , generally known as firmware.  Initializates all aspects of system from CPU to registers to device controllers to memory contents.  Loads operating system kernel into memory and starts execution the first process such “init” and waiting for some event to occur. 

Ref: Operating System Concepts with Java – 7 th Edition

1.10

Prof. Dr. Hanafy Ismail


Computer Startup (cont.) The occurrence of an event is signaled by an interrupt from either the hardware or the software.  Hardware may trigger an interrupt at any time by sending a signal to the CPU by way of the system bus.  Software triggers an interrupt by executing a special operation called a system call ( or monitor call) 

Ref: Operating System Concepts with Java – 7 th Edition

1.11

Prof. Dr. Hanafy Ismail


Interrupt Handling When the CPU is interrupted, it stops what is doing and immediately transfer execution to the starting address where the service routine for the interrupt is located.  The interrupt service routine executes; on completion, the CPU resumes the interrupted computation. 

Ref: Operating System Concepts with Java – 7 th Edition

1.12

Prof. Dr. Hanafy Ismail


Common Functions of Interrupts 

 

Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines for the varies devices. Generally the interrupt vector (table of pointers) is stored in low memory e.g. ( the first 100 locations). Interrupt architecture must save the address of the interrupted instruction. Recent architectures store the return address on the system stack. After the interrupt is serviced, the saved return address is loaded into the program counter and the interrupted computation resumes.

Ref: Operating System Concepts with Java – 7 th Edition

1.13

Prof. Dr. Hanafy Ismail


Common Functions of Interrupts (cont.) Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt.  A trap is a software-generated interrupt caused either by an error or a user request.  An operating system is interrupt driven. 

Ref: Operating System Concepts with Java – 7 th Edition

1.14

Prof. Dr. Hanafy Ismail


Operating System Structure (Multiprogramming) 

Multiprogramming needed for efficiency (varies system resources are utilized effectively):  Single user cannot keep CPU and I/O devices busy at all times  Multiprogramming organizes jobs (code and data) so CPU always has one to execute  A subset of total jobs in system is kept in memory ( The total jobs that entered the system kept in a job pool)  One job selected and run via job scheduling  When it has to wait (for I/O for example), OS switches to another job

Ref: Operating System Concepts with Java – 7 th Edition

1.15

Prof. Dr. Hanafy Ismail


Memory Layout for Multiprogrammed System

Ref: Operating System Concepts with Java – 7 th Edition

1.16

Prof. Dr. Hanafy Ismail


Operating System Structure (Timesharing) 

Timesharing (multitasking) is logical extension of multiprogramming in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing. Time-shared OS allows many users to share the same computer simultaneously.  Response time for user instructions should be short ( < 1 second )  A little CPU time is needed for each user.  Each user has at least one program executing in memory  A program loaded into memory and executing is called a process

Ref: Operating System Concepts with Java – 7 th Edition

1.17

Prof. Dr. Hanafy Ismail


Operating System Structure (Timesharing) 

  

Time-sharing and multiprogramming require several jobs to be kept simultaneously in memory. The jobs are kept initially in the job pool (the pool consists of all processes residing on disk awaiting allocation of main memory) If several jobs ready to run at the same time  CPU scheduling. When the OS selects a job from the pool it loads that job into memory for execution Having several programs in memory at the same time requires some form of memory management

Ref: Operating System Concepts with Java – 7 th Edition

1.18

Prof. Dr. Hanafy Ismail


Operating System Structure (Timesharing)  

If processes don’t fit in memory, swapping moves them in and out to run Virtual memory allows execution of processes not completely in memory. It enables users to run programs that are larger than the actual physical memory. Time-sharing systems must also provide a file system. The file system resides on a collection of disks. Disk management must be provided Time-sharing systems provide a mechanism for protecting resources from inappropriate use.

Ref: Operating System Concepts with Java – 7 th Edition

1.19

Prof. Dr. Hanafy Ismail


Operating-System Operations   

Modern operating systems are Interrupt driven. Events are signaled by the occurrence of an interrupt (hardware) or a trap. a trap ( or exception) is a software-generated interrupt caused either by:  an error ( e.g. Division by zero), or  a specific request from a user program for operating system service. For each type of interrupt, an interrupt service routine is provided that is dealing with the interrupt.

Ref: Operating System Concepts with Java – 7 th Edition

1.20

Prof. Dr. Hanafy Ismail


Operating-System Operations

With Sharing, many processes could be affected by a bug in one program ( e.g. process problems include infinite loop, processes modifying each other or the operating system).  A properly designed operating system must insure that an incorrect program cannot cause other programs to execute incorrectly. 

Ref: Operating System Concepts with Java – 7 th Edition

1.21

Prof. Dr. Hanafy Ismail


Operating-System Operations  

Dual-mode operation : allows OS to protect itself and other system components. To distinguish between the execution of operating system code and user code, we need two separate modes of operations:  User mode, and  kernel mode (supervisor mode , system mode)

Ref: Operating System Concepts with Java – 7 th Edition

1.22

Prof. Dr. Hanafy Ismail


Operating-System Operations  Mode bit provided by hardware  Provides ability to distinguish when system is running user code or kernel code ( 0 (kernel mode , 1 (user mode) )  At system boot time, the hardware starts in kernel mode. The OS is then loaded and starts user applications in user mode. When a user application requests a service from the operating system via a system call, it must transition from user to kernel mode to fulfill the request.

Ref: Operating System Concepts with Java – 7 th Edition

1.23

Prof. Dr. Hanafy Ismail


Operating-System Operations  Some

instructions that may cause harm are designated as privileged, only executable in kernel mode  System call changes mode to kernel, return from call resets it to user

Ref: Operating System Concepts with Java – 7 th Edition

1.24

Prof. Dr. Hanafy Ismail


Operating-System Operations

Ref: Operating System Concepts with Java – 7 th Edition

1.25

Prof. Dr. Hanafy Ismail


Transition from User to Kernel Mode 

A Timer can be used to prevent a user program from getting stuck in an infinite loop / process hogging resources  It can be set to interrupt the computer after specific period. The period may be fixed or variable.  A variable timer is generally implemented by a fixed-rate clock and a counter.  Operating system decrements counter every time the clock ticks  When the counter reaches zero, an interrupt occurs.  Set up before scheduling process to regain control or terminate program that exceeds allotted time. A simple technique is to initialize the counter with amount of time that a program is allowed to run.

Ref: Operating System Concepts with Java – 7 th Edition

1.26

Prof. Dr. Hanafy Ismail


Process Management 

 

A process is a program in execution. It is a unit of work within the system:  A word-processing program being run by an individual user on a PC is a process.  A system task, such as sending output to a printer can also be a process or part of it Program (contents of a file stored on disk) is a passive entity, process is an active entity. Process needs resources to accomplish its task  CPU, memory, I/O, files  Initialization data Process termination requires reclaim of any reusable resources

Ref: Operating System Concepts with Java – 7 th Edition

1.27

Prof. Dr. Hanafy Ismail


Process Management 

 

Single-threaded process has one program counter specifying location of next instruction to execute  Process executes instructions sequentially, one at a time, until completion Multi-threaded process has one program counter per thread Typically system has many processes, some user, some operating system running concurrently on one or more CPUs  Concurrency by multiplexing the CPUs among the processes / threads

Ref: Operating System Concepts with Java – 7 th Edition

1.28

Prof. Dr. Hanafy Ismail


Process Management Activities The operating system is responsible for the following activities in connection with process management:  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

Ref: Operating System Concepts with Java – 7 th Edition

1.29

Prof. Dr. Hanafy Ismail


Memory Management 

All instructions in memory in order to execute

 

Memory management activities  Keeping track of which parts of memory are currently being used and by whom  Deciding which processes (or parts thereof) and data to move into and out of memory  Allocating and deallocating memory space as needed

Ref: Operating System Concepts with Java – 7 th Edition

1.30

Prof. Dr. Hanafy Ismail


Storage Management 

Computer can store data on several different types of physical media. Each medium is controlled by device (i.e., disk drive, tape drive) that has its own characteristics.  Varying properties include access speed, capacity, data-transfer rate, access method (sequential or random) OS activities include in connection with file management:  Creating and deleting files and directories  Primitives to manipulate files and dirs  Mapping files onto secondary storage  Backup files onto stable (non-volatile) storage media

Ref: Operating System Concepts with Java – 7 th Edition

1.31

Prof. Dr. Hanafy Ismail


Caching   

storing parts of data in faster storage for performance Information in use copied from slower to faster storage temporarily Faster storage (cache) checked first to determine if information is there  If it is, information used directly from the cache (fast)  If not, data copied to cache and used there

Ref: Operating System Concepts with Java – 7 th Edition

1.32

Prof. Dr. Hanafy Ismail


I/O Subsystem  

One purpose of OS is to hide characteristics of hardware devices from the user I/O subsystem responsible for  Memory management of I/O including:  buffering (storing data temporarily while it is being transferred),  caching (storing parts of data in faster storage for performance),  spooling (the overlapping of output of one job with input of other jobs)

Ref: Operating System Concepts with Java – 7 th Edition

1.33

Prof. Dr. Hanafy Ismail


Protection and Security Protection – any mechanism for controlling access of processes or users to resources defined by the OS  Security – defense of the system against internal and external attacks  Huge range, including denial-of-service, worms, viruses 

Ref: Operating System Concepts with Java – 7 th Edition

1.34

Prof. Dr. Hanafy Ismail


Protection and Security 

Systems generally first distinguish among users, to determine who can do what  User identities (user IDs, security IDs) include name and associated number, one per user  User ID then associated with all files, processes of that user to determine access control  Group identifier (group ID) allows set of users to be defined and controls managed, then also associated with each process, file

Ref: Operating System Concepts with Java – 7 th Edition

1.35

Prof. Dr. Hanafy Ismail


ef:

End of Chapter 1

Operating System Concepts with Java – 7 th Edition,

Prof. Dr. Hanafy Ismail


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.