OS - System Structure


Published on

Published in: Education, Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

OS - System Structure

  1. 1. System Structure Organized By: Vinay Arora Assistant Professor CSED, TU Vinay Arora CSED,TU
  2. 2. Disclaimer This is NOT A COPYRIGHT MATERIAL Content has been taken mainly from the following books: Operating Systems Concepts By Silberschatz & Galvin,Operating Systems: Internals and Design Principles By William Stallings www.os-book.com www.cs.jhu.edu/~yairamir/cs418/os2/sld001.htm www.personal.kent.edu/~rmuhamma/OpSystems/os.html http://msdn.microsoft.com/en-us/library/ms685096(VS.85).aspxhttp://www.computer.howsttuffworks.com/operating-system6.htm http://williamstallings.com/OS/Animations.html http://msdn.microsoft.com/en-us/library/aa450566.aspx www.os-book.com http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html Etc… Vinay Arora CSED,TU
  3. 3. Operating System Services User Interface - Almost all operating systems have a user interface. Command-Line (CLI), Graphics User Interface (GUI) Program Execution - The system must be able to load a program into memory and to run that program, end execution. I/O Operations - A running program may require I/O, which may involve a file or an I/O device. File-System Manipulation - Programs need to read and write files and directories, create and delete them, search them, list file Information, permission management. Vinay Arora CSED,TU
  4. 4. Operating System Services Vinay Arora CSED,TU
  5. 5. Communications – Processes may exchange information. Communications may be via shared memory or through message passing.Error Detection – OS needs to be constantly aware of possible errors May occur in the CPU and memory hardware, in I/O devices or in user program For each type of error, OS should take the appropriate action. Debugging facilities Vinay Arora CSED,TU
  6. 6. Operating System Interface - CLI CLI 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 Vinay Arora CSED,TU
  7. 7. CLI Vinay Arora CSED,TU
  8. 8. CLI Vinay Arora CSED,TU
  9. 9. Operating System Interface - GUI User-friendly desktop metaphor interface Usually mouse, keyboard, and monitor Icons represent files, programs, actions, etc Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory (known as a folder) Many systems now include both CLI and GUI interfaces Vinay Arora CSED,TU
  10. 10. GUI Vinay Arora CSED,TU
  11. 11. Layered View Vinay Arora CSED,TU
  12. 12. System Call Programming interface to the services provided by the OS. Typically written in a high-level language (C or C++) The invocation of an operating system routine. Operating systems contain sets of routines for performing various low- level operations. For example, all operating systems have a routine for creating a directory. If you want to execute an operating system routine from a program, you must make a system call. Vinay Arora CSED,TU
  13. 13. Mostly accessed by programs via a high-level Application ProgramInterface (API) rather than direct system call use.Why use APIs rather than system calls? – There are specific reasons forusing APIs or Programming with APIs, Instead of direct System Calls. Vinay Arora CSED,TU
  14. 14. System Call Sequence when Copying from One File to another Vinay Arora CSED,TU
  15. 15. API Consider the ReadFile() function in the Win32 API—a function for reading from a file Description of the parameters passed to ReadFile() HANDLE file—the file to be read LPVOID buffer—a buffer where the data will be read into and written from DWORD bytesToRead—the number of bytes to be read into the buffer LPDWORD bytesRead—the number of bytes read during the last read LPOVERLAPPED ovl—indicates if overlapped I/O is being used Vinay Arora CSED,TU
  16. 16. System Call Implementation Typically, a number associated with each system call System-call interface maintains a table indexed according to these numbers The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values The caller need know nothing about how the system call is implemented Just needs to obey API and understand what OS will do as a result call Most details of OS interface hidden from programmer by API Managed by run-time support library (set of functions built into libraries included with compiler) Vinay Arora CSED,TU
  17. 17. System Call Interface Vinay Arora CSED,TU
  18. 18. Example – Windows/Unix system Call Vinay Arora CSED,TU
  19. 19. Types of System Calls Process Control File Management Device Management Information Maintenance Communications Vinay Arora CSED,TU
  20. 20. System Program Provide a convenient environment for program development and execution Some of them are simply user interfaces to system calls; others are considerably more complex Vinay Arora CSED,TU
  21. 21. Standard C Library Example C program invoking printf() library call, which calls write() system call Vinay Arora CSED,TU
  22. 22. Operating System Design & Implementation Important principle to separate Policy: What will be done? Mechanism: How to do it? Mechanisms determine how to do something, policies decide what will be done The separation of policy from mechanism is a very important principle, it allows maximum flexibility if policy decisions are to be changed later Vinay Arora CSED,TU
  23. 23. Layered Approach The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers Vinay Arora CSED,TU
  24. 24. Layered View of Operating System Vinay Arora CSED,TU
  25. 25. Microkernel System Structure Moves as much from the kernel into “user” space Communication takes place between user modules using message passing Benefits: Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) More secure Detriments: Performance overhead of user space to kernel space communication Vinay Arora CSED,TU
  26. 26. Virtual Machines Fundamental Idea behind a virtual machine is to abstract the hardware of a single Computer into several different execution environments. Illusion will be created that each separate execution environment is running its own private computer. The Operating System creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory. The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. Vinay Arora CSED,TU
  27. 27. VMware Architecture Vinay Arora CSED,TU
  28. 28. BIOS Vinay Arora CSED,TU
  29. 29. Motherboard BIOS Vinay Arora CSED,TU
  30. 30. System Boot Operating system must be made available to hardware so hardware can start it Small piece of code – bootstrap loader, locates the kernel, loads it into memory, and starts it Sometimes two-step process where boot block at fixed location loads bootstrap loader When power initialized on system, execution starts at a fixed memory location Firmware used to hold initial boot code Vinay Arora CSED,TU
  31. 31. Booting Steps Power On the Computer Machine. NO Data to process for the Processor. Data present in BIOS ROM will be processed first. Perform POST. Display System Settings. Load Interrupt Handler and Device Drivers. Check CMOS for custom settings. Initiate the Bootstrap sequence. Searching for target BOOT drive. Locate the MBR . Start OS. Vinay Arora CSED,TU
  32. 32. Thnx… Vinay Arora CSED,TU