Topic 6 - The operating system
The “Role of the Operating System” topic covers the OS’s role in managing memory, peripherals, and hardware interfaces. It outlines OS resource management techniques like scheduling, policies, multitasking, virtual memory, paging, interrupt, and polling. It discusses the advantages of a dedicated OS for a device, such as size, speed, and customization. It also explains how an OS hides the hardware’s complexity from users and applications, and the issues of proprietary software and localisation.
6.1.5 Explain the role of the operating system in terms of managing memory, peripherals and hardware interfaces.
Key Terms
- Operating System
- Kernel
- Device Driver
- Virtual memory
- Multitasking
- GUI
- Peripheral
The operating system (OS) is like the director of your computer, coordinating all the different parts and ensuring they work together seamlessly. Here's how it manages the key elements:
Memory Management
Allocation: The OS decides which program gets what portion of memory (RAM) to work with. It's like a careful librarian, ensuring each book (program) has its own shelf space and they don't get mixed up.
Protection: It prevents programs from stepping on each other's toes by accessing memory allocated to others. This avoids crashes and keeps your data safe.
Virtual Memory: When you run out of RAM, the OS cleverly uses some of your hard drive space as "virtual memory." It's like having an extra bookshelf in the basement when the main one is full. This allows you to run more programs than your physical RAM would normally allow.
Peripheral Management
Device Drivers: These are translators between the OS and your peripherals (keyboard, mouse, printer, etc.). Each device has its own language, and the driver helps the OS understand and communicate with it.
Resource Allocation: The OS ensures that peripherals get the resources they need (processing power, memory access, etc.) to function correctly.
Plug and Play: Modern OSes make it easy to connect new devices. They automatically detect the device, find the right driver, and set everything up – no more hunting for CDs or installation files.
Hardware Interfaces
Abstraction: The OS provides a consistent way for software to interact with hardware, regardless of the specific components. It's like having a universal remote that works with any TV, even if they have different internal workings.
Processor Management: The OS schedules and prioritises tasks, ensuring that the computer's processor (CPU) is used efficiently. It's like a traffic controller, directing the flow of instructions to avoid jams.
Input/Output (I/O) Management: It handles the flow of data between the computer and the outside world, managing communication with devices like hard drives, network cards, and USB ports
6.1.7 Outline OS resource management techniques: scheduling, policies, multitasking, virtual memory, paging, interrupt, and polling.
Key Terms
- Scheduling
- Policies
- Multitasking
- Virtual memory
- Paging
- Interrupt
- Polling
Technical details as to how these are carried out will not be required, but it is expected that students will be familiar with these techniques and understand when and why they are used.
Scheduling
What it is: The OS acts like an air traffic controller, deciding which process (program) gets to use the CPU and for how long.
Why it's needed: Ensures fair allocation of CPU time, preventing any single process from hogging resources and causing others to freeze.
Types: Various scheduling algorithms exist (e.g., First-Come, First-Served, Shortest Job First, Priority Scheduling) each with its pros and cons.
Several factors need to be considered to assess what scheduling algorithm is required.
- Throughput
- Maximising the number of jobs in a time unit
- Latency
- Time taken to complete tasks
- Fairness
- Appropriate times according to each process' priority
The different types of scheduling are assessed below in the table.
Scheduling algorithm | CPU Overhead | Turnaround time | Throughput | Response time |
First In First Out | Low | High | Low | Low |
Shortest job first | Medium | Medium | High | Medium |
Priority based scheduling | Medium | High | Low | High |
Round-robin scheduling | High | Medium | Medium | High |
Multilevel Queue scheduling | High | Medium | High | Medium |
Policies
What they are: Rules and guidelines that govern how resources are allocated and managed.
Examples:
- Fair-share scheduling: Ensures each user or process gets a fair share of resources.
- Real-time scheduling: Prioritises time-critical tasks (e.g., in industrial control systems).
- Power management policies: Determine when to dim the screen or put the computer to sleep to conserve energy.
Multitasking
What it is: The OS's ability to seemingly run multiple programs simultaneously.
How it works: It rapidly switches between different processes, giving the illusion of parallel execution.
Benefits: Allows you to have multiple applications open and switch between them seamlessly.
Since most computers can do at most one or two things at one time, this is generally done via time-sharing, which means that each program uses a share of the computer's time to execute.
An operating system kernel contains a piece of software called a scheduler which determines how much time each program will spend executing, and in which order execution control should be passed to programs.
Virtual memory
What it is: A technique that extends available RAM by using a portion of the hard drive as "virtual memory."
How it works: The OS divides programs into "pages" and swaps inactive pages to the hard drive, freeing up RAM for active programs.
Benefits: Lets you run larger programs and multitask more effectively, even with limited RAM.
The operating system is responsible for managing the memory of the system to ensure that there are no conflicts of memory usage between all the currently running programs and processes. This can sometimes involve using a portion of the disk drive as primary memory. This has major drawbacks as the speed of a hard disk is several orders slower than the main memory. Each piece of memory data is given a virtual address. This may translate into a physical address in primary or secondary memory.
Paging
What it is: The process of dividing a program's memory into fixed-size "pages" and storing them in RAM or virtual memory.
How it works: When a program needs a page that's not in RAM, the OS brings it in from the hard drive.
Benefits: Enables efficient use of memory and supports virtual memory.
In computer operating systems, paging is a memory-management scheme by which a computer can store and retrieve data to and from physical storage for use in virtual memory. In the paging memory-management scheme, the operating system retrieves data from physical memory in same-size blocks called pages.
The main advantage of paging over memory segmentation is that it allows the physical address space of a process to be noncontiguous. Before paging came into use, systems had to fit whole programs into storage contiguously, which caused various storage and fragmentation problems.
Interrupts
What it is: A signal that tells the CPU to stop its current task and handle a more urgent request.
Example: When you press a key, a keyboard interrupt is generated, causing the OS to read the keystroke.
Benefits: Allows for immediate response to events, improving system responsiveness.
An interrupt is a signal sent from a hardware device or an application to the microprocessor to indicate that attention (a service) is required.
Polling
What it is: The OS continuously checks the status of devices to see if they need attention.
Example: Checking if the mouse has moved or if data has arrived on a network port.
Drawback: Can be less efficient than interrupts, as it consumes CPU time even when no events are occurring.
6.1.8 Discuss the advantages of producing a dedicated operating system for a device.
1. Optimised Performance: A dedicated operating system (OS) can be tailored specifically to the hardware of the device it's designed for. This allows for better resource management, minimising overhead and maximising performance. The OS can be streamlined, with only necessary features and drivers included, resulting in faster boot times, smoother operation, and improved responsiveness.
2. Enhanced Security: A dedicated OS can be hardened with security features specifically designed for the device's intended use case. This can include measures like secure boot, application whitelisting, and sandboxing to mitigate the risk of malware and unauthorised access. Additionally, the OS can be regularly updated with security patches and enhancements to address vulnerabilities and keep the device protected.
3. Customisation and Flexibility: A dedicated OS provides greater control over the user experience. Manufacturers can customise the interface, pre-install specific applications, and tailor the OS to meet the specific needs of the device's target audience. This can result in a more intuitive and user-friendly experience, with features and functionality that are relevant to the device's purpose.
4. Reduced Resource Consumption: A dedicated OS can be designed to be lightweight and efficient, consuming fewer system resources like memory and storage. This can be particularly important for devices with limited resources, such as embedded systems or wearable devices. A smaller OS footprint can also lead to longer battery life and improved overall performance.
5. Improved Stability and Reliability: By focusing on a specific hardware configuration and use case, a dedicated OS can be thoroughly tested and optimised for stability and reliability. This can minimise the occurrence of crashes, freezes, and other issues that can arise from incompatibilities or conflicts between the OS and the hardware. A dedicated OS can also be designed to be fault-tolerant and resilient to failures, ensuring the device remains operational even in the face of unexpected errors.
6. Innovation and Differentiation: Developing a dedicated OS allows manufacturers to differentiate their products from the competition. They can introduce unique features, optimise performance for specific tasks, and create a distinct brand identity for their devices. This can be a key factor in attracting customers and gaining a competitive advantage in the market.
Examples of Dedicated Operating Systems:
iOS (Apple): Designed specifically for iPhones and iPads, offering a seamless user experience and tight integration with Apple's hardware ecosystem.
watchOS (Apple): A dedicated OS for Apple Watches, optimised for small screens and wearable device functionality.
Android Automotive OS (Google): Tailored for in-vehicle infotainment systems, with features like voice control, navigation, and media playback.
Real-Time Operating Systems (RTOS): Used in embedded systems for critical applications where timing and responsiveness are paramount, such as industrial automation and medical devices.
Overall, the advantages of producing a dedicated operating system for a device are significant, ranging from improved performance and security to greater customisation and flexibility. This approach allows manufacturers to create tailored solutions that meet the specific needs of their target audience and differentiate their products in the market.
6.1.9 Outline how an operating system hides the complexity of the hardware from users and applications.
Operating systems act as a sophisticated layer of abstraction, shielding users and applications from the intricate inner workings of computer hardware.
Here's how they achieve this:
Device Drivers:
- Translating the language of hardware: Each hardware component speaks its own unique language. Device drivers act as interpreters, allowing the OS to communicate with these devices without needing to know the specifics of their operation.
- Providing a standardised interface: Drivers present a consistent interface to the OS, regardless of the underlying hardware. This means an application can access any printer in the same way, even if they are different models from different manufacturers.
System Calls:
- Simplifying interaction: System calls provide a set of standardised functions that applications can use to request services from the OS, such as reading files, accessing the network, or displaying graphics.
- Hiding the low-level details: Applications don't need to know how these operations are performed at the hardware level. They simply request a system call, and the OS takes care of the rest.
File Systems:
- Organising data: The OS provides a hierarchical file system that allows users to organise and access data in a logical way, without needing to know the physical location of the data on the storage device.
- Abstracting storage devices: Different storage devices (hard drives, SSDs, USB drives) have different characteristics. The file system presents a unified view of storage, hiding these differences from users and applications.