Presentation on theme: "Operating System Structures"— Presentation transcript:
1 Operating System Structures Chapter 2Operating System Structures
2 Common System Components Due 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.
3 Common System Components Process ManagementMain Memory ManagementFile ManagementI/O System ManagementSecondary ManagementNetworkingProtection SystemUser Interface/Command-Interpreter System
4 Basic OS Organization Each manager: Manager tasks Works closely with other managersPerforms a unique roleManager tasksMonitor its resources continuouslyEnforce policies determining:Who gets what, when, and how muchAllocate the resource (when appropriate)Deallocate the resource (when appropriate)
5 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.
6 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
7 Main Memory Management All data in memory before and after processingAll instructions in memory in order to executeMemory management determines what is in memory whenOptimizing CPU utilization and computer response to usersMemory management activities include:Keeping track of which parts of memory are currently being used and by whomDeciding which processes (or parts thereof) and data to move into and out of memoryAllocating and deallocating memory space as needed
8 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.
9 File ManagementThe operating system is responsible for the following activities in connections with file management:Creating and deleting files and directoriesPrimitives to manipulate files and dirsMapping files onto secondary storageBackup files onto stable (non-volatile) storage media
10 I/O System ManagementOne purpose of OS is to hide peculiarities of hardware devices from the userI/O subsystem responsible forMemory 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
11 Secondary Storage Management Since 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 timeProper management is of central importanceEntire speed of computer operation hinges on disk subsystem and its algorithms
12 Secondary Storage Management The operating system is responsible for the following activities in connection with disk management:Free space managementStorage allocationDisk scheduling
13 Networking (Distributed Systems) A distributed system provides user access to various system resources.Retains user access control
14 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 attacksHuge range, including denial-of-service, worms, viruses, identity theft, theft of serviceSystems generally first distinguish among users, to determine who can do whatUser identities (user IDs, security IDs) include name and associated number, one per userUser ID then associated with all files, processes of that user to determine access controlGroup identifier (group ID) allows set of users to be defined and controls managed, then also associated with each process, filePrivilege escalation allows user to change to effective ID with more rights
15 Protection System The protection mechanism must: Distinguish between authorized and unauthorized usage.Specify the controls to be imposed.Provide a means of enforcement.
16 Command-Interpreter System Command Line Interface (CLI) or command interpreter allows direct command entrySometimes implemented in kernel, sometimes by systems programSometimes multiple flavors implemented – shellsPrimarily fetches a command from user and executes itSometimes commands built-in, sometimes just names of programsIf the latter, adding new features doesn’t require shell modification
17 User Operating System Interface - GUI User-friendly desktop metaphor interfaceUsually mouse, keyboard, and monitorIcons 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 PARCMany 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)
20 System Calls Programming interface to the services provided by the OS Typically 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 useThree 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?
21 Requesting Services from OS System CallProcess traps to OS Interrupt HandlerSupervisor mode setDesired function executedReturns to applicationMessage PassingUser process constructs message indicating function (service needed)Invokes send to pass message to OSProcess blocks……OS receives messageOS initiates function executionUpon function completion, OS returns “OK”Process unblock…