1 / 139

Operating System Concepts

Operating System Concepts. About Operating System and Kernels. O.S vs Kernels Batching processing Multi – user, Multi- processing O.S Layered Processing Distributed system Real Time O.S. What is an Operating System?.

melaniea
Télécharger la présentation

Operating System Concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Operating System Concepts

  2. About Operating System and Kernels • O.S vs Kernels • Batching processing • Multi – user, Multi- processing O.S • Layered Processing • Distributed system • Real Time O.S

  3. What is an Operating System? • A program that acts as an intermediary between a user of a computer and the computer hardware. • Operating system goals: • Execute user programs and make solving user problems easier. • Make the computer system convenient to use. • Use the computer hardware in an efficient manner.

  4. Computer System Components • Hardware – provides basic computing resources (CPU, memory, I/O devices). • Operating system – controls and coordinates the use of the hardware among the various application programs for the various users. • Applications programs – define the ways in which the system resources are used to solve the computing problems of the users (compilers, database systems, video games, business programs). 4. Users (people, machines, other computers).

  5. Users Assembler Compiler Text Editor Database ………… System and Application Program Operating System Computer Hardware Abstract View of System Components

  6. Operating System Definitions • Resource allocator – manages and allocates resources. • Control program – controls the execution of user programs and operations of I/O devices . • Kernel – the one program running at all times (all else being application programs).

  7. Kernel Definition • The kernel is a program that constitutes the central core of a computer operating system. It has complete control over everything that occurs in the system. • A kernel can be contrasted with a shell (such as bash, csh or ksh in Unix-like operating systems), which is the outermost part of an operating system and a program that interacts with user commands. • The kernel itself does not interact directly with the user, but rather interacts with the shell and other programs as well as with the hardware devices on the system, including the processor (also called the central processing unit or CPU), memory and disk drives.

  8. The kernel is the first part of the operating system to load into memory during booting (i.e., system startup), and it remains there for the entire duration of the computer session because its services are required continuously. • Thus it is important for it to be as small as possible while still providing all the essential services needed by the other parts of the operating system and by the various application programs. • Because of its critical nature, the kernel code is usually loaded into a protected area of memory, which prevents it from being overwritten by other.

  9. The kernel performs its tasks, such as executing processes and handling interrupts, in kernel space. • whereas everything a user normally does, such as writing text in a text editor or running programs in a GUI (graphical user interface), is done in user space. • This separation is made in order to prevent user data and kernel data from interfering with each other and thereby diminishing performance or causing the system to become unstable (and possibly crashing).

  10. When a computer crashes, it actually means the kernel has crashed. • If only a single program has crashed but the rest of the system remains in operation. • The kernel provides basic services for all other parts of the operating system, typically including: • memory management, • process management, • file management and • I/O (input/output) management (i.e., accessing the peripheral devices) • These services are requested by other parts of the operating system or by application programs through a specified set of program interfaces referred to as system calls.

  11. The BIOS • The BIOS (Basic Input/Output System). The BIOS is an independent program stored in a chip on the motherboard (the main circuit board of a computer) • That is used during the booting process for such tasks as initializing the hardware and loading the kernel into memory. • Whereas the BIOS always remains in the computer and is specific to its particular hardware. • The kernel can be easily replaced or upgraded by changing or upgrading the operating system or, in the case of Linux, by adding a newer kernel or modifying an existing kernel.

  12. Most kernels have been developed for a specific operating system, and there is usually only one version available for each operating system. • For example, the Microsoft Windows 2000 kernel is the only kernel for Microsoft Windows 2000 and the Microsoft Windows 98 kernel is the only kernel for Microsoft Windows 98. • Linux is far more flexible in that there are numerous versions of the Linux kernel, and each of these can be modified in innumerable ways by the user. • A few kernels have been designed with the goal of being suitable for use with any operating system. • The best known of these is the Mach kernel, which was developed at Carnegie-Mellon University and is used in the Macintosh OS X operating system.

  13. Categories of Kernels • Kernels can be classified into four broad categories: • monolithic kernels, • microkernels, • hybrid kernels and • exokernels. • Each has its own advocates and detractors.

  14. Monolithic kernel • Monolithic kernels, which have traditionally been used by Unix-like operating systems, contain all the operating system core functions and the device drivers. • Modern monolithic kernels, such as those of Linux and FreeBSD, both of which fall into the category of Unix-like operating systems, feature the ability to load modules at runtime, • Thereby allowing easy extension of the kernel's capabilities as required, while helping to minimize the amount of code running in kernel space.

  15. Micro kernels • The kernel provides only a small set of functions, such as some synchronization facilities, an elementary scheduler and inter process communication mechanisms. • Important functions like memory management, device drivers, system call handlers etc., run on top of the micro kernel. • These are all glued together. • Examples of microkernel operating systems are: • AIX, BeOS, Mac OS X, MINIX and QNX.

  16. Microkernels are easier to maintain than monolithic kernels, but the large number of system calls and context switches might slow down the system because they typically generate more overhead than plain function calls. • Microkernels generally underperform traditional designs, sometimes dramatically. • a context switch, to move data between the various applications and servers.

  17. Hybrid kernels • Hybrid kernels are similar to microkernels, except that they include additional code in kernel space so that such code can run more swiftly than it would were it in user space. • These kernels represent a compromise that was implemented by some developers before it was demonstrated that pure microkernels can provide high performance. • Hybrid kernels should not be confused with monolithic kernels that can load modules after booting (such as Linux). • Most modern operating systems use hybrid kernels, including Microsoft Windows NT, 2000 and XP. DragonFly BSD, a recent fork (i.e., variant) of FreeBSD, is the first non-Mach based BSD operating system to employ a hybrid kernel architecture.

  18. Exokernels are a still experimental approach to operating system design. • They differ from the other types of kernels in that their functionality is limited to the protection and multiplexing of the raw hardware, • and they provide no hardware abstractions on top of which applications can be constructed. • This separation of hardware protection from hardware management enables application developers to determine how to make the most efficient use of the available hardware for each specific program.

  19. Exokernels in themselves they are extremely small. • However, they are accompanied by library operating systems, • which provide application developers with the conventional functionalities of a complete operating system. • A major advantage of exokernel-based systems is that they can incorporate multiple library operating systems, each exporting a different API (application programming interface), • such as one for Linux and one for Microsoft Windows, thus making it possible to simultaneously run both Linux and Windows applications.

  20. Simple Batch System • The major task of the operating system was to transfer control from one job to the next. The OS was always resident in the memory. • A batch OS normally reads a stream of separate jobs ,each with its own control cards that predefine what the job does. When the job is complete ,its output is usually printed. • The definitive feature of batch system is the lack of interaction between the user and the job when the job is executing. The job is prepared and submitted ,and some time later ,the output appears. The delay between the job submission and job completion (called turn around time) may result from the amount of computing needed, or from delays before the OS starts the job.

  21. User Program Memory Layout for a Simple Batch System OS

  22. 0 OS Job 1 Job 2 Job 3 512k Multi-programmed Batch Systems • Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them. • All the jobs that enter a system enter the job pool. This pool consists of all processes residing on the mass storage awaiting allocation of memory.

  23. The OS keeps several jobs in the memory at a time, This set of jobs is a subset of the jobs in the job pool. • The OS picks and begins executing one of the jobs in the memory. • Eventually the job may have to wait for some task , such as a tape to be mounted or an I/O operation to be completed. • In a multi-programmed system the OS the CPU would not be idle as in a non- multi-programmed system, but will simply switch to execute other jobs. • When that job need to wait the CPU switches to another job and so on. Eventually the first job finishes waiting and it gets the CPU back. As long as there is always some job to execute the CPU will never be idle.

  24. Features Needed for Multiprogramming • I/O routine supplied by the system. • Memory management – the system must allocate the memory to several jobs. • CPU scheduling – the system must choose among several jobs ready to run. • Allocation of devices.

  25. Time-Sharing Systems–Interactive Computing • 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 swapped in and out of memory to the disk. • On-line communication between the user and the system is provided; when the operating system finishes the execution of one command, it seeks the next “control statement” from the user’s keyboard. • On-line system must be available for users to access data and code.

  26. Desktop Systems • Personal computers – computer system dedicated to a single user. • I/O devices – keyboards, mice, display screens, small printers. • User convenience and responsiveness. • Can adopt technology developed for larger operating system’ often individuals have sole use of computer and do not need advanced CPU utilization of protection features. • May run several different types of operating systems (Windows, MacOS, UNIX, Linux)

  27. Parallel Systems • Multiprocessor systems with more than one CPU in close communication. • Tightly coupled system – processors share memory and a clock; communication usually takes place through the shared memory. • Advantages of parallel system: • Increased throughput • Economical • Increased reliability • graceful degradation • fail-soft systems

  28. Parallel Systems (Cont.) • Symmetric multiprocessing (SMP) • Each processor runs and identical copy of the operating system. • Many processes can run at once without performance deterioration. • Most modern operating systems support SMP • Asymmetric multiprocessing • Each processor is assigned a specific task; master processor schedules and allocated work to slave processors. • More common in extremely large systems

  29. Distributed Systems • Distribute the computation among several physical processors. • Loosely coupled system – each processor has its own local memory; processors communicate with one another through various communications lines, such as high-speed buses or telephone lines. • Advantages of distributed systems. • Resources Sharing • Computation speed up – load sharing • Reliability • Communications

  30. Distributed Systems (cont) • Requires networking infrastructure. • Local area networks (LAN) or Wide area networks (WAN) • May be either client-server or peer-to-peer systems.

  31. General Structure of Client-Server Client Client Client Network Server

  32. Clustered Systems • Clustering allows two or more systems to share storage. • Provides high reliability. • Asymmetric clustering: one server runs the application while other servers standby. • Symmetric clustering: all N hosts are running the application.

  33. Real-Time Systems • 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. • Well-defined fixed-time constraints. • Real-Time systems may be either hard or soft real-time.

  34. Real-Time Systems (Cont.) • Hard real-time: • Secondary storage limited or absent, data stored in short term memory, or read-only memory (ROM) • Conflicts with time-sharing systems, not supported by general-purpose operating systems. • Soft real-time • Limited utility in industrial control of robotics • Useful in applications (multimedia, virtual reality) requiring advanced operating-system features.

  35. Handheld Systems • Personal Digital Assistants (PDAs) • Cellular telephones • Issues: • Limited memory • Slow processors • Small display screens.

  36. Operating System components

  37. Operating System components • Into to Process management sub system • Into to Memory management sub system • Intro to File sub system • Into to Device drivers • Signals and System calls

  38. Process management sub system • A process is a program in execution. A process needs certain resources, including CPU time, memory, files, and I/O devices, to accomplish its task. • The operating system is responsible for the following activities in connection with process management. • Process creation and deletion. • process suspension and resumption. • Provision of mechanisms for: • process synchronization • process communication

  39. Memory management sub system • Primary-Memory or Main-Memory is a large array of words or bytes. Each word or byte has its own address. Main-memory provides storage that can be access directly by the CPU. That is to say for a program to be executed, it must in the main memory. • The major activities of an operating in regard to memory-management are: • Keep track of which part of memory are currently being used and by whom. • Decide which process are loaded into memory when memory space becomes available. • Allocate and de allocate memory space as needed.

  40. File sub system • The five main major activities of an operating system in regard to file management are • The creation and deletion of files. • The creation and deletion of directions. • The support of primitives for manipulating files and directions. • The mapping of files onto secondary storage. • The back up of files on stable storage media.

  41. Device drivers • The CPU is not only the intelligent device in the system, every device has its own hardware controller. • The software that handles or manages the hardware controller is known as a device drivers. • The device drivers that translate user I/O function calls into specific hardware device I/O requests as well as file system and network drivers. • The hardware abstraction layer (HAL) is a layer of code that isolates the kernel, device drivers, and the rest of the executive from platform-specific differences (such as differences between motherboards).

  42. Signals and System calls • The kernel keeps track of a process's creation time as well as the CPU time that it consumes during its lifetime. Each clock tick, the kernel updates the amount of time that the current process has spent in system and in user mode. • A process can use these timers to send itself various signals each time that they expire. Three sorts of interval timers are supported: • Real : the timer ticks in real time, and when the timer has expired, the process is sent a SIGALRM signal. • Virtual :This timer only ticks when the process is running and when it expires it sends a SIGVTALRM signal. • Profile :This timer ticks both when the process is running and when the system is executing on behalf of the process itself. SIGPROF is signaled when it expires. • Every clock tick the current process's interval timers are decremented and, if they have expired, the appropriate signal is sent.

  43. All processes run partially in user mode and partially in system mode. User mode has far less privileges than system mode. Each time a process makes a system call it swaps from user mode to system mode and continues executing. • At this point the kernel is executing on behalf of the process. • Each process decides to relinquish the CPU that it is running on when it has to wait for some system event. For example, a process may have to wait for a character to be read from a file. • This waiting happens within the system call, in system mode; the process used a library function to open and read the file and it, in turn made system calls to read bytes from the open file. • In this case the waiting process will be suspended and another, more deserving process will be chosen to run.

  44. Processes are always making system calls and so may often need to wait. Even so, if a process executes until it waits then it still might use a disproportionate amount of CPU time and so Linux uses pre-emptive scheduling. In this scheme, each process is allowed to run for a small amount of time, 200ms, and, when this time has expired another process is selected to run and the original process is made to wait for a little while until it can run again. This small amount of time is known as a time-slice. It is the scheduler that must select the most deserving process to run out of all of the run able processes in the system.

  45. Process Management sub system

  46. Process management sub system • Creating process • Process Id, process descriptor • Process contexts • Process state • Process address space • Process scheduling policies • Threads vs process • Multi threading and Hyper threading

  47. Process control : Introduction • Processes carry out tasks within the operating system. • A process can be thought of as a program in execution. • Process also include PC and all CPU registers as well as the process stacks containing temporary data. • Unix/Linux is a multiprocessing system

  48. Process Creation • Parent process creates children processes, which, in turn create other processes, forming a tree of processes. • Resource sharing • Parent and children share all resources. • Children share subset of parent’s resources. • Parent and child share no resources. • Execution • Parent and children execute concurrently. • Parent waits until children terminate. • Address space • Child duplicate of parent. • Child has a program loaded into it.

  49. Mode and space • In order to run Unix, the computer hardware must provide two modes of execution - a more privileged kernel mode and less privileged user mode. Kernel protects some parts of address space from user. Moreover certain privileged instructions such as those manipulate memory management registers, may only be executed only in the kernel mode. • Many computers have more than two execution modes The Intel architecture m/cs provide four rings of execution.- the inner most is more privileged . Unix however uses only two of these rings

  50. Most Unix implementations use virtual memory. In virtual memory system the addresses used by a program don’t refer directly to locations in physical memory. • Each process has virtual address space , references to virtual memory are translated to physical memory locations using set of address translation maps. • Many systems implement these maps as page tables, with one entry for each page of process address space.

More Related