



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




In this lecture we take a look at the Operating System (OS). The OS is a program which acts as a layer between application programs and the computer hardware. We study how the Operating System allows us to run multiple programs simultaneously on both single and multiple CPUs. Programs can generally be written as if they are the only program running on a computer. The OS is responsible for sharing the CPU between different processes. Programs are also written as if they are the only program using computer memory. The OS handles the relationship between the program’s simplified view of memory and the actual physical memory in the computer. We also take a look at how multi-threaded programs allow us to take full advantage of multi-core CPUs, but also introduce some real perils for the programmer. Interaction between threads is non-deterministic, giving different results for the same input, depending on outside factors. This makes it difficult to find and debug errors. The Need for Operating Systems The Operating System is system software which acts as a layer between application software and the actual computer hardware. Let’s start out by taking a look at why we need an operating system. No Operating System In the simplest case, there is no system software. The program runs directly on the computer hardware. While this approach certainly works, as we saw previously in our CPU lecture, working directly with hardware can be very difficult. Just as we probably don’t want to write machine language code to access the CPU directly, accessing Input/Ouput devices directly can also be difficult.
Hardware Abstraction System software called device drivers provides application programmers with a higher, more abstract view of the Input/Ouput devices. We’ll take a closer look at these later in the lecture. Supporting Multiple Applications On desktop, laptop, and mobile devices, we all run multiple programs simultaneously. How is this feat done? The Operating System coordinates and controls access to the hardware for different applications. Supporting Multiple Users Computers not only support multiple applications, they also sometimes support multiple users. Whether allowing different users to have accounts on the same machine and controlling who can read which files, or going further and allowing different users to run applications simultaneously, the Operating System protects and controls who has access to which files and resources.
Executing Processes
o This is called Inter-Process Communication (IPC). o A variety of different methods may be provided depending on the operating system. For example, processes might pass information using files, by passing messages, or by explicitly sharing a section of memory. Virtual and Physical Address Spaces
When we have a situation where sometimes the program will work and sometimes it won’t depending on the exact sequence in which two different threads operate we say that we have a Race Condition. Errors caused by Race Conditions are very hard to find and remove because they are not easily reproduced.