Operating System Architecture Lecture 7 Software hierarchy Operating

  • Slides: 27
Download presentation
Operating System Architecture Lecture 7

Operating System Architecture Lecture 7

Software hierarchy

Software hierarchy

Operating System components • User interface – Older systems: shell – text based –

Operating System components • User interface – Older systems: shell – text based – Newer systems: GUI, e. g. Window system • Kernel – File manager - groups files into directories – collection of device drivers - programs that let the OS communicate with the computer hardware (E. g. Graphic card, Sound card, Computer printer) – Memory manager - coordinates the machine’s use of main memory. – Scheduler and dispatcher • scheduler determines which activities are to be considered for execution, and the dispatcher controls the allocation of time to these activities.

Kernel • A kernel is the central part of an OS. • It manages

Kernel • A kernel is the central part of an OS. • It manages the tasks of the computer and the hardware • A computer user never interacts directly with the kernel. It runs behind the scenes and cannot be seen, except for the text logs that it prints.

Kernel types • Two types of kernels: 1. Microkernel, which only contains basic functionality;

Kernel types • Two types of kernels: 1. Microkernel, which only contains basic functionality; (e. g. MINIX) 2. Monolithic kernel, which contains many drivers. (e. g. Windows, Mac. OS, Linux and etc) 3. Hybrid

Issues with kernels • Reliability – for expl: micro kernels are more reliable since

Issues with kernels • Reliability – for expl: micro kernels are more reliable since services run separate address space • Performance – for expl: since services run sharing the same address space making communication between them easy monolithic kernels are more performant • Portability- can be ported from one machine to another • Layered and extensibility(can be extended easily)

Kernel: File manager • maintains records of all the files stored in mass storage

Kernel: File manager • maintains records of all the files stored in mass storage – File location – which users are allowed to access the various files, – which portions of mass storage are available for new files or extensions to existing files. • directory or folder • directory path - A chain of directories within directories WIUT/Semester 2/FIT

Kernel: Device drivers • Device drivers communicate with the controllers (or directly with peripheral

Kernel: Device drivers • Device drivers communicate with the controllers (or directly with peripheral devices) to carry out operations on the peripheral devices attached to the machine. • Each device driver is uniquely designed for its particular type of device (such as a printer, disk drive, or monitor) and translates generic requests into the more technical steps required by the device assigned to that driver.

Kernel: Memory manager • In multiuser or multitasking environments – many programs and blocks

Kernel: Memory manager • In multiuser or multitasking environments – many programs and blocks of data must reside in main memory concurrently. • Memory manager must find assign memory space for these needs and ensure that the actions of each program are restricted to the program’s allotted space. • Moreover, as the needs of different activities come and go, the memory manager must keep track of those memory areas no longer occupied.

Issues with memory management 1. Single Contiguous Memory Management entire application program is loaded

Issues with memory management 1. Single Contiguous Memory Management entire application program is loaded into one large chunk of memory. 2. Partition Memory Management fixed partitions- main memory is divided into a particular number of partitions. dynamic partitions- the partitions are created to fit the need of the programs. 3. Paged Memory Management main memory is divided into small fixed-size blocks of storage called frames. A process is divided into pages

Kernel: scheduler and dispatcher • scheduler - determines which activities are to be considered

Kernel: scheduler and dispatcher • scheduler - determines which activities are to be considered for execution, • dispatcher - controls the allocation of time to these activities.

Coordinating the Machine’s Activities • Process - The activity of executing a program under

Coordinating the Machine’s Activities • Process - The activity of executing a program under the control of the OS • Process state - current status of the activity, • OS manages these processes so that each process has the resources (peripheral devices, space in main memory, access to files, and access to a CPU) that it needs, that independent processes do not interfere with one another, and that processes that need to exchange information are able to do so.

Interrupts • Each time the dispatcher awards a time slice to a process, it

Interrupts • Each time the dispatcher awards a time slice to a process, it initiates a timer circuit that will indicate the end of the slice by generating a signal called an interrupt • When the CPU receives an interrupt signal, it completes its current machine cycle, saves its position in the current process and begins executing a program, called an interrupt handler, which is stored at a predetermined location in main memory. This interrupt handler is a part of the dispatcher, and it describes how the dispatcher should respond to the interrupt signal.

Thus, the effect of the interrupt signal is to preempt the current process and

Thus, the effect of the interrupt signal is to preempt the current process and transfer control back to the dispatcher.

File Systems • File - a named collection of data, used for organizing secondary

File Systems • File - a named collection of data, used for organizing secondary memory • File system - the operating system’s logical view of the files it manages • Directory - a named group of files • File type - the specific kind of information contained in a file, such as a Java program or a Microsoft Word document • File extension - Part of a file name that indicates the file type

File Systems • You can name a file anything you want (as long as

File Systems • You can name a file anything you want (as long as you use the characters that the operating system allows for file names). • You could give any file a. gif extension, for instance, but that doesn’t make it a GIF image file. • Changing the extension does not change the data in the file or its internal format. If you attempt to open a misnamed file in a program that expects a particular format, you get errors.

File operations • • • Create a file. Delete a file. Open a file.

File operations • • • Create a file. Delete a file. Open a file. Close a file. Read data from a file. Write data to a file. Reposition the current file pointer in a file. Append data to the end of a file. Truncate a file (delete its contents). Rename a file. Copy a file.

File Access • Sequential file access - the technique in which data in a

File Access • Sequential file access - the technique in which data in a file is accessed in a linear fashion • Direct file access - the technique in which data in a file is accessed directly, by specifying logical record numbers

File Protection • In multiuser systems, file protection is of primary importance. That is,

File Protection • In multiuser systems, file protection is of primary importance. That is, we don’t want one user to be able to access another user’s files unless the access is specifically allowed. • It is the operating system’s responsibility to ensure valid file access. • Different operating systems administer their file protection in different ways.

Directories • A directory, in most operating systems, is represented as a file. The

Directories • A directory, in most operating systems, is represented as a file. The directory file contains data about the other files in the directory. • For any given file, the directory contains the file name, the file type, the address on disk where the file is stored, and the current size of the file. • The directory also contains information about the protections set up for the file. It may also contain information about when the file was created and when it was last modified.

Directories: path names • Path - a text designation of the location of a

Directories: path names • Path - a text designation of the location of a file or subdirectory in a file system • Absolute path - path that begins at the root and includes all successive subdirectories Linux/Unix Windows /etc/samba. smb. conf /boot/grub. conf C: Program FilesMicrosoft OfficeOffice 12VISSHE. DLL D: My. FolderFITLecture 7. pptx • Relative path - path that begins at the current working directory Linux/Unix Windows . . /samba. smb. conf . . /grub. conf . . Office 12VISSHE. DLL. . FITLecture 7. pptx

Windows directory tree

Windows directory tree

Unix directory tree

Unix directory tree

Disk Scheduling • Disk scheduling - technique that the operating system uses to determine

Disk Scheduling • Disk scheduling - technique that the operating system uses to determine which requests to satisfy first is called • Seek time is the time it takes for the heads to reach the appropriate cylinder. • Latency is the additional time it takes the platter to rotate into the proper position so that the information can be read or written. • Seek time is the more restrictive of these two, and therefore is the primary issue dealt with by the disk-scheduling algorithms.

Disk Scheduling

Disk Scheduling

Disk-scheduling algorithms • First-Come, First-Served Disk Scheduling (FCFS) – one of the easiest to

Disk-scheduling algorithms • First-Come, First-Served Disk Scheduling (FCFS) – one of the easiest to implement, though not usually the most efficient. – we process the requests in the order they arrive, without regard to the current position of the heads. • Shortest-Seek-Time-First Disk Scheduling (SSTF) – moves the heads the minimum amount it can to satisfy any pending request. – Starvation could be the issue - it is possible for some requests never to be serviced because requests closer to the read/write heads keep being issued. • SCAN Disk Scheduling – the read/write heads move in toward the spindle, then out toward the platter edge, then back toward the spindle, and so forth. – Employs the same strategy as an elevator, sweeping from one end of the disk to the other.

Bibliography • Dale, Computer Science Illuminated, Chapter 10, 11, end of the book exercises

Bibliography • Dale, Computer Science Illuminated, Chapter 10, 11, end of the book exercises • J. Brookshear, An Overview of Computer Science 11 th ed (intro txt) - (Pearson, 2012) BBS • Randy Wang, Operating Systems, System Calls, and Buffered I/O