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

Post on 01-Apr-2015

217 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Operating System Structures

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.

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

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)

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.

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

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

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.

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

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

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

Secondary Storage ManagementThe operating system is responsible for the

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

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

various system resources.Retains user access control

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

Protection SystemThe protection mechanism must:

Distinguish between authorized and unauthorized usage.

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

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

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)

Summary of Functions Provided by OS

A View of Operating System Services

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?

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…

Requesting Services from OS

System Calls

System Calls

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

Types of System CallsProcess controlFile managementDevice managementInformation maintenanceCommunicationsProtection

Examples of Windows and Unix System Calls

top related