Operating Systems
Total Page:16
File Type:pdf, Size:1020Kb
Operating-System Services and Structure Operating Systems P. Healy CS1-08 Computer Science Bldg. tel: 202727 [email protected] Autumn 2020–2021 P. Healy (University of Limerick) CS4023 Autumn 2020–2021 1 / 22 Operating-System Services and Structure Outline 1 Operating-System Services and Structure OS Services: Assistance to the User OS Services: Efficient Operation OS Operations P. Healy (University of Limerick) CS4023 Autumn 2020–2021 2 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Operating System Definition Intermediary between a user of a computer and the computer hardware Control program Controls execution of programs to prevent errors and improper use of the computer Resource allocator Manages all resources Decides between for efficient and fair resource use P. Healy (University of Limerick) CS4023 Autumn 2020–2021 3 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Operating System Design Design and Implementation of OS not “solvable”, but some approaches have proven successful Internal structure of different Operating Systems can vary widely Affected by choice of hardware, type of system User goals and System goals User goals: operating system should be , easy to learn, reliable, System goals: operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient P. Healy (University of Limerick) CS4023 Autumn 2020–2021 4 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations A View of Operating System Services P. Healy (University of Limerick) CS4023 Autumn 2020–2021 5 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Outline 1 Operating-System Services and Structure OS Services: Assistance to the User OS Services: Efficient Operation OS Operations P. Healy (University of Limerick) CS4023 Autumn 2020–2021 6 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations User Interfaces User interface (UI) (CLI) Graphics User Interface (GUI) P. Healy (University of Limerick) CS4023 Autumn 2020–2021 7 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations User Interface – CLI CLI allows Sometimes several alternatives implemented – shells Primarily fetches a command from user and executes it Sometimes commands built-in, sometimes just names of programs P. Healy (University of Limerick) CS4023 Autumn 2020–2021 8 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations User Interface – GUI User-friendly interface (desktop metaphor) Usually mouse, keyboard, and monitor Icons represent folders, files, programs, actions, etc. Various mouse buttons over objects in the interface cause various actions Many systems now include both CLI and GUI interfaces Linux, like all UNIXs has CLI and has additional GUI interfaces: KDE, Gnome, Xfce Microsoft Windows is GUI with CLI “command” shell Apple Mac OS X has “Aqua” GUI interface with UNIX kernel underneath and shells available Solaris is CLI with optional GUI interfaces (Java Desktop) P. Healy (University of Limerick) CS4023 Autumn 2020–2021 9 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Further OS Services (Assistance) Program execution: OS must be able to load a program into memory, run that program, and end execution (either normally or abnormally) I/O operations: A running program (process) may require I/O, which may involve a file or an I/O device File-system manipulation: File system is of particular interest Processes need to read and write files and directories create and delete them search them list file information P. Healy (University of Limerick) CS4023 Autumn 2020–2021 10 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Further OS Services (Assistance) (contd.) Multiprogramming The CPU always has ; when the currently running process needs to wait (e.g., for I/O), OS allocates the CPU to another job Time-sharing (multitasking) Logical extension to multiprogramming; the CPU switches processes so frequently that users can interact with each process while it is running, creating interactive computing P. Healy (University of Limerick) CS4023 Autumn 2020–2021 11 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Further OS Services (Assistance) (contd.) Communications: Processes may exchange information, on the same computer or over a network Communications may be via 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, in user program For each type of error, OS should take the appropriate action to ensure correct and consistent computing P. Healy (University of Limerick) CS4023 Autumn 2020–2021 12 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations A Political Struggle Some of the great political thinkers of our time: here P. Healy (University of Limerick) CS4023 Autumn 2020–2021 13 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Outline 1 Operating-System Services and Structure OS Services: Assistance to the User OS Services: Efficient Operation OS Operations P. Healy (University of Limerick) CS4023 Autumn 2020–2021 14 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations OS Services to Maintain Efficient Operation Resource allocation: When multiple users or multiple jobs running concurrently, resources must be allocated to each of them Many types of resources: some (such as CPU cycles, main memory, and file storage) may have special allocation protocol (specialist algorithms) Others (such as I/O devices) may have general request and release protocol Accounting: To keep track of which users use how much and what kinds of computer resources P. Healy (University of Limerick) CS4023 Autumn 2020–2021 15 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations OS Services to Maintain Efficient Operation (contd.) Protection and security: to control use of shared data (on a multiuser system or a network) Protection involves ensuring that all access to system resources is controlled Security of the system from outsiders requires user authentication, extends to defending external I/O devices from invalid access attempts If a system is to be protected and secure, precautions must be instituted throughout – chain is only as strong as its weakest link P. Healy (University of Limerick) CS4023 Autumn 2020–2021 16 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Outline 1 Operating-System Services and Structure OS Services: Assistance to the User OS Services: Efficient Operation OS Operations P. Healy (University of Limerick) CS4023 Autumn 2020–2021 17 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Supporting Typical OS Operations The interrupt mechanism: Supports several of the typical operations an OS must support: making a system call managing a timer Interrupt driven by hardware Software error or request creates exception or trap Division by zero, request for operating system service Other process problems including infinite loop stack overflow processes modifying each other or the operating system P. Healy (University of Limerick) CS4023 Autumn 2020–2021 18 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Interrupts: System calls Dual-mode operation allows OS to protect itself and other system components User mode and kernel mode Mode bit provided by hardware Provides ability to distinguish when system is running user code or kernel code Some instructions designated as privileged, only executable in kernel mode System call changes mode to kernel, return from call resets it to user Excellent discussion of dual mode here P. Healy (University of Limerick) CS4023 Autumn 2020–2021 19 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Making a System Call Transition from User to Kernel Mode P. Healy (University of Limerick) CS4023 Autumn 2020–2021 20 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Interrupts: Timer Timer to prevent infinite loop / process hogging resources Set interrupt after specific period Operating system decrements counter When counter zero generate an interrupt Set up before scheduling process to regain control or terminate program that exceeds allotted time P. Healy (University of Limerick) CS4023 Autumn 2020–2021 21 / 22 OS Services: Assistance to the User Operating-System Services and Structure OS Services: Efficient Operation OS Operations Hierarchical Protection Domains Protection Rings Hierarchical Protection Domains, also known as protection rings Hardware supported rings were introduced by Multics However, most general-purpose UNIX Privilege rings for X86 systems use only two processor family rings, even if the hardware it runs on provides more CPU modes than that P. Healy (University of Limerick) CS4023 Autumn 2020–2021 22 / 22.