operating system structures. common system components due to the complex nature of the modern...

26
Operating System Structures

Upload: armani-hiller

Post on 01-Apr-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Operating System Structures

Page 2: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Common System ComponentsDue to the complex nature of the modern

operating systems, it is partitioned into smaller component.

Each component performs a well-defined function with well-defined inputs and outputs.

Page 3: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Common System ComponentsProcess Management Main Memory ManagementFile ManagementI/O System ManagementSecondary ManagementNetworkingProtection SystemUser Interface/Command-Interpreter System

Page 4: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Basic OS OrganizationEach manager:

Works closely with other managers

Performs a unique roleManager tasks

Monitor its resources continuously

Enforce policies determining: Who gets what, when, and

how much Allocate the resource (when

appropriate) Deallocate the resource

(when appropriate)

Page 5: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Process ManagementA process is a program in execution (More

about process in chapter 4)A process needs certain resources, including

CPU time, memory, files, and I/O devices, to accomplish its task.

These resources are either given to the process when it is created or when it is running. When the process completes, the OS reclaims all the resources.

Page 6: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Process ManagementThe operating system is responsible for the

following activities in connection with process management.Creating and deleting both user and system

processesSuspending and resuming processesProviding mechanisms for process

synchronizationProviding mechanisms for process

communicationProviding mechanisms for deadlock handling

Page 7: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Main Memory ManagementAll data in memory before and after processingAll instructions in memory in order to executeMemory management determines what is in memory when

Optimizing CPU utilization and computer response to usersMemory management activities include:

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

Page 8: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

File ManagementComputers can store information on several

different types of physical media (e.g. magnetic tap, magnetic disk, CD etc).

For convenient use of the computer system, the OS provides a uniform logical view of information storage.

A file is a logical storage unit, which abstract away the physical properties of its storage device.Commonly, files represent programs (both

source and object forms) and data.

Page 9: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

File ManagementThe operating system is responsible for the

following activities in connections 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

Page 10: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

I/O System ManagementOne purpose of OS is to hide peculiarities of

hardware devices from the userI/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)

General device-driver interfaceDrivers for specific hardware devices

Page 11: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Secondary Storage ManagementSince main memory (primary storage) is

volatile and too small to accommodate all data and programs permanently, the computer system must provide secondary storage to back up main memory.

Usually disks used to store data that does not fit in main memory or data that must be kept for a “long” period of time

Proper management is of central importanceEntire speed of computer operation hinges on

disk subsystem and its algorithms

Page 12: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Secondary Storage ManagementThe operating system is responsible for the

following activities in connection with disk management: Free space managementStorage allocationDisk scheduling

Page 13: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Networking (Distributed Systems)A distributed system provides user access to

various system resources.Retains user access control

Page 14: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Protection SystemProtection – any mechanism for controlling access of processes or

users to resources defined by the OSSecurity – defense of the system against internal and external

attacks Huge range, including denial-of-service, worms, viruses, identity theft,

theft of serviceSystems 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 Privilege escalation allows user to change to effective ID with more

rights

Page 15: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Protection SystemThe protection mechanism must:

Distinguish between authorized and unauthorized usage.

Specify the controls to be imposed.Provide a means of enforcement.

Page 16: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Command-Interpreter SystemCommand Line Interface (CLI) or command

interpreter allows direct command entry Sometimes implemented in kernel, sometimes by

systems program Sometimes multiple flavors implemented – shells Primarily fetches a command from user and

executes it Sometimes commands built-in, sometimes just

names of programs If the latter, adding new features doesn’t require

shell modification

Page 17: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

User Operating System Interface - GUIUser-friendly desktop metaphor interface

Usually mouse, keyboard, and monitor Icons represent files, programs, actions, etcVarious mouse buttons over objects in the interface cause

various actions (provide information, options, execute function, open directory (known as a folder)

Invented at Xerox PARC

Many systems now include both CLI and GUI interfacesMicrosoft Windows is GUI with CLI “command” shellApple Mac OS X as “Aqua” GUI interface with UNIX kernel

underneath and shells availableSolaris is CLI with optional GUI interfaces (Java Desktop, KDE)

Page 18: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Summary of Functions Provided by OS

Page 19: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

A View of Operating System Services

Page 20: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

System CallsProgramming interface to the services provided by the

OSTypically written in a high-level language (C or C++)Mostly accessed by programs via a high-level

Application Program Interface (API) rather than direct system call use

Three most common APIs are Win32 API for Windows, POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM)

Why use APIs rather than system calls?

Page 21: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Requesting Services from OSSystem Call

Process traps to OS Interrupt Handler Supervisor mode set Desired function executed Returns to application

Message Passing User process constructs message indicating function (service needed) Invokes send to pass message to OS Process blocks …… OS receives message OS initiates function execution Upon function completion, OS returns “OK” Process unblock…

Page 22: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Requesting Services from OS

Page 23: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

System Calls

Page 24: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

System Calls

C program invoking printf() library call, which calls write() system call

Page 25: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Types of System CallsProcess controlFile managementDevice managementInformation maintenanceCommunicationsProtection

Page 26: Operating System Structures. Common System Components Due to the complex nature of the modern operating systems, it is partitioned into smaller component

Examples of Windows and Unix System Calls