Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems CSCI-6140 – Computer Operating Systems David Goldschmidt, Ph.D. What is an Operating System? The software interface between hardware and its users Operating systems: Execute user and system programs Manage and coordinate computer hardware Serve as resource allocators Provide system security for programs and data System calls (for programmers) System programs (for general users) Commands (for superusers) Filesystem (for all users) Includes devices, network connections, etc. From a user’s perspective: System goals: reliability easy to use flexibility easy to learn extensibility reliable speed(y) safe efficiency fast maintainability etc. etc. An operating system provides services: Program execution ▪ Load programs into memory, run/suspend/halt programs, handle/display errors I/O operations ▪ Seamlessly interact with I/O devices, including disks, networks connection, etc. Filesystem manipulation ▪ Read/write/traverse filesystem directories, read/write files, enforce permissions, search for files Other operating system services: Inter-Process Communications (IPC) ▪ Processes exchange information via shared memory, message passing, sockets, pipes, files, etc. ▪ Often spans multiple computers and networks Error detection and recovery ▪ Detect errors in CPU, memory, I/O devices, processes, network connections, etc. ▪ Recover from errors gracefully, ensuring correct and consistent operations Other operating system services: Resource allocation ▪ Process scheduling, memory management Account and resource protection ▪ Users, groups, account verification, memory protection, synchronization, etc. Usage monitoring ▪ Processes, users, networks ▪ Log files In the beginning... ...the 1940s Automation in the 1950s with punch cards A job is a unit of work submitted by a user to the operating system Jobs typically consist of: a program either in a source language or in “executable” binary form input data used by the program when it executes Purpose is to produce output IBM 360 introduced (in 1964) a computing revolution! what’s so revolutionary? In multiprogramming, several processes reside in memory at the same time CPU is shared and managed by the operating system Addresses the problem of the CPU being underutilized (use context switching) Computer is often idle – why? CPU and hardware significantly faster than I/O When a user or process is blocked waiting for I/O, the operating system switches to another process A subset of processes is stored in memory, awaiting CPU or I/O Multiprogramming provides efficient use of the computer (CPU) and its resources (I/O) One user cannot keep the CPU and I/O devices busy at all times Multiprogramming attempts to organize processes so that the CPU is as busy as possible By overlapping I/O with computation, we need interrupts and interrupt handlers Interrupts are handled much like calling a function in a programming language I/O is typically buffered interrupt processing times vary... ...and so do I/O transfer times Synchronous Asynchronous To ensure fairness, use timesharing in which the CPU cycles through all processes Each process is given a fixed amount of CPU time (a CPU burst) Switching from one running process to another is called a context switch A process relinquishes its time when requesting I/O Program instructions run either in user mode or in kernel mode switch modes via system calls Kernel mode allows the operating system to protect itself and its system components Text CRTs (1970s) to an early Mac (1984) Personal computer revolution (1970s/80s) The battle begins... World Wide Web and Internet revolution (1990s/2000s) Sir Tim Berners-Lee Mobile revolution (2010s) very fast very small volatile non-volatile very slow very large Caching is a technique in which data is temporarily stored in a smaller and faster memory component Why implement caching in an operating system? A key goal in operating system design is achieving fast and efficient performance What’s the caching algorithm? When the operating system attempts to read from memory, check to see if the requested data is already in the cache If it is, data is read from the cache (fast!) If not, data is copied from memory to the cache (maybe next time...) When a running program reads from memory location X, the principle of locality predicts that the next memory location requested will be near X memory location X Store pages of data in a cache, where each page is typically the same size (e.g. 16MB) Implement a program to simulate caching: Write a function called calculateAnswer() that takes integer n as input and calculates (and returns) the sum (1 + 2 + … + n) ▪ Pretend this method is computationally costly! Initially, the cache (holds only 11 elements) is empty ▪ Ask the user to input a number in range 1..100 ▪ If the answer is not in the cache, call calculateAnswer() and display the resulting sum; store the result in the cache ▪ If the answer is in the cache, simply display the answer