--- Role of the operating system ---


Explain the role of the operating system in terms of managing memory, peripherals and hardware interfaces.


Teaching Note:

For example, allocating storage and keeping track of programs in memory, swapping between programs on time-slicing, priority or when one is waiting for input.

Sample Question:


From Sample Paper 1 - 2014:

From Sample Paper 1 - 2014:

JSR Notes

First of all note that there's another earlier, SL assessment statement almost the same as this; it's 2.1.6. And there's an arguably even better organization of all the OS operating system parts at the bottom of this page under the Former Curriculum section.

So here it makes sense to focus in on the various specific things mentioned both in the assessment statement itself and the teaching note. First of all recall what we mean by an operating system:

Definition of "Operating System" - An operating system is the collection of software which runs a digital device. It has several roles, from low level interactions with the hardware, to high level interactions with the user. Common computer operating systems are the Mac OS, Windows, Unix, and Linux. Common mobile phone operating systems are Android, iOS and Windows Mobile.


I. OS Management of Memory

(Looking back to the earlier, SL, 2.1.6 that we did, this encompasses: Memory Management, Software Execution Control, File Maintenance, and Virtual Memory - you can see a repeat of that down below, in the "Former Curriculum" section of these notes.)

Review Definition of Memory

Computer memory is a general word for all data stored and worked with on a computer or other digital device. Within a computer or other device run by an operating system there are generally three categories of memory: cache, RAM, and secondary storage.

- Secondary storage maintains data files and applications in a permanent way. Generally, secondary storage is either some sort of magnetic media, such as a hard drive, or flash media such as SSD drive.
- RAM is fast, volatile, expensive memory, where data files and applications are loaded when they are being worked with.
- Cache is very fast RAM which is located on or very close to the CPU and is used for temporarily storing frequently used commands.

*** Definitely take a good look at the Mac OS utility Activity Monitor for this part of the assessment statement.

So, what needs to be managed vis-a-vis memory?

To help categorize the various things regarding memory the OS is responsible for, let's take each of the three main kinds of memory, and for each one think of the "what/when" and "how much".

Regarding Memory, the OS manages:
1. Storage & Virtual Memory

A. What/When - Determination of when is virtual memory to be used. (Virtual memory is using secondary storage as working memory - so part of an HD acting as RAM.) Keep in mind that virtual memory will always be significantly slower than real memory, even if it's an SSD acting virtually. So as an OS, your strategy will be to choose to use virtual memory mainly when you are running out of real memory and you have open applications crying out for more.

B. How much - The determination of how much virtual memory should be allocated to various tasks and applications, when having to resort to it.

Regarding Memory, the OS manages...
2. RAM

A. What/When - When swapping in and out of memory (from the storage) is to take place, based on priority of various processes/applications, and optimization of RAM usage.

Consider the analogy of loading up the gym with stuff and either leaving it there when finished with it, or cleaning it up (i.e. "swapping it out") when finished with it. The next time it is needed, stuff left in memory (or lying around the gym) can be accessed quickly. But because the gym is cluttered, things done there are done more slowly. So a good strategy, balancing these two points is to swap stuff out of memory after a certain amount of time of inactivity.

B. How much - How much RAM each process/application is allocated. Ideally applications would like as much RAM memory as the can get, but it's usually not a good idea for all of an application to load into RAM from the hard drive. One reason for not doing so is slowing down other applications, another is the time it would take to load everything into memory.) So the OS has to share out the RAM evenly and intelligently.

C. Plus, memory considerations when it is working with CPU "Time-slicing" processes. Time-slicing is a form of multi-tasking, in which more than one process/application seemingly runs at the same time. It is done by quickly swapping back and forth form the RAM to the CPU multiple processes; a little bit of process 1 is done, then a little bit of process 2, then back to process 1, and so on. So you can think of this as an OS/software version of multitasking/hyperthreading. An anaolgy would be a plate spinner at a circus spinning multiple plates, or even a social networking student" "juggling" many different tasks on their computer, seemingly at the same time.

Regarding Memory, the OS manages...
3. Cache

A. What/When - What things are to be stored in cache (Level 1 cache is probably controlled by the hardware, but Level 3 cache could be controlled by the OS.) S, the things that are most often done over and over again can be identified by the OS (in conjunction with the hardware) and copies stored in cache.

B. How much - This depends on how much cache there is, but those tasks and applications sending commands most repetitively to the CPU will be given more cache space.

II. OS Management of Peripherals

(Looking back to the earlier, SL, 2.1.6 that we did, this encompasses the following OS management categories: Input/Output (I/O) Control, and Software/Hardware Interface, and Drivers Management - you can see a repeat of all of that down below, in the "Former Curriculum" section of these notes - and this is actually very useful as an overall view)

First of all a Definition of "Peripherals" - A peripheral is any digital hardware component attached to a computer or other device which has input ports. (They are, literally, "peripheral" to the main machine; i.e. on the periphery; i.e. outside.) So peripherals are not hard-wired onto the motherboard of a device; they are therefore most often "third-party" hardware - i.e. not made by the same company that made the computer. Common peripherals to computers and laptops are mice, speakers, external hard drives, keyboards and monitors. Peripherals can be wireless as well as wired.

A variety of peripherals

So what needs to be managed vis-a-vis peripherals?

(Do note that it's not always only the device being connected to whose OS is managing things; the connected device, like a phone to a computer, may also have an OS, and so it will surely also be involved with handling the connection.)

Regarding Peripherals, the OS manages: Initialization Stages

  1. Power Distribution
    The OS will have to manage devices/components requiring different voltages. And it will control when to send electricity in the first place. For example, a computer might stop delivering electricity to a plugged in phone when the phone indicates it is fully charged, or when the computer itself is running low on charge.
  2. Input and Output (I/O)
    This is pretty fundamental; peripherals are connected so that data and commands can be communicated back and forth, i.e. brought into the computer and sent out to the peripheral device.
    • With input and output, any and all of the layers of the OSI network model may be involved. For example for networking, the TCP protocol might be used by the OS at the transport layer, and the IP protocol is used by the OS on the network layer.
  3. Hand-shaking" and Ejecting Routines
    In hand-shaking, when the device is connected, the main thing that has to quickly be determined is what common "languages" both the peripheral device and the computer "speak", i.e. which protocols can the adhere to. Here is a good zoom-able picture of what goes on with a modem's dial-up handshake messages.

  4. ...Regarding Peripherals, the OS manages...
    Communcation Stages

  5. Communication Protocols
    Between successful hand-shaking and ejecting, the OS, with the drivers, and according to certain protocols will determing how the communication procedes.
  6. Wireless Connectivity & Protocols
    In the case of wireless peripherals.
  7. Peripheral Drivers
    The OS will work with the drivers that are needed to operate the peripheral. (Drivers are software programs, often quite small, which operate peripherals.)

  8. ...Regarding Peripherals, the OS manages... Possible Issues

  9. Data Transfer Speed
    Important here is the the speeds to/from the peripheral/computer are compatible, so that one is not overwhelmed by the speed of the other.
  10. Error Handling
    Also according to the protocols being used.
  11. Security
    Though, certainly, anti-virus and malware programs help also, to a certain extent the OS is involved in security as well.

III. OS Management of Hardware Interfaces

First of all a Definition of "Hardware Interfaces" - A point of interaction between two pieces of hardware. This could definitely include peripheral devices to computers, but as a separate category, we can thing of this as being the hardware interfaces between various components within a device; that in fact ship with the device, such as internal hard drives. So you can think of any part of the computer which is directly connected to the motherboard as having a hardware interface to it.

Common hard drive hardware interfaces are SATA and IDE (Integrated Drive Electronics). Particular hardware interfaces have specific physical specifications (see the diagram below) as well as specific software protocols for the connection of the devices. (Continue reading below the diagram...)

Image of SATA hardware interface (above) and IDE hardware interface (below)
(both, as pictured, being used for the connection of conventional internal hard drives)

What needs to be managed by the OS vis-a-vis hardware interfaces? Many of the same things that need to be managed for peripherals. But with internal devices there is no need for things such as hand-shaking/ejecting, security, or wireless management.

Regarding Hardware Interfaces, the OS manages:

  1. The control of power supply.
  2. The input and output of information to and from the two devices.
  3. The speed of data transfer.
  4. Any error handling with the transfer of data.
  5. Plus, Regarding Hardware Interfaces, the OS may manage RAID control: A RAID is a "Redundant Array of Independent Disks" where mirroring of data over two or more hard drives serves as as backup, and/or striping of data over two or more hard drives makes writing and reading faster.

    Both striping (RAID 0) and mirroring (RAID 1)
    Wikipedia CC BY-SA 3.0

    (Though note that often this is done through a dedicated RAID controller. In such a case, the RAID will been seen by the OS as a single volume, and so there is no particular RAID control by the OS.)



Teaching Note Particulars

Here is just a bit more, focusing on each part of the following Teaching Note:

"For example,
allocating storage and keeping track of programs in memory,
swapping between programs on time-slicing,
priority or when one is waiting for input."

- Allocating storage and keeping track of programs in memory, By "storage" they would be referring to secondary storage, i.e. the hard drive, etc. To "allocate" is to allot a certain part of memory to something. And so the OS is responsible for determining where in secondary storage programs and data files to be kept long term are placed. Part of this would be optimizing where the programs are put, remembering that the more they are kept together on the hard drive (as opposed to being scattered, i.e. "fragmented") the better. And so "defragmentation" would also be included in the storage management - in which fragmented files are pieced together again all in one place.

In terms of keeping track of programs in memory, something has to do this in order for program and parts of those programs to be found by the CPU when executing code. The "memory" being referred to here would be RAM memory. (So "allocating storage and keeping track of programs in memory" would be referring both to secondary storage and to RAM memory.)

- Swapping between programs on time-slicing, Time-slicing is actually a processing term, in which the processor shares out its time to multiple tasks. But the point here is that the OS will have to work hand in hand with the CPU to assure the things being processed on are in memory, indeed in the cache, possibly swapping out programs when they are not at the top of the time-slicing priority list.

- Priority or when one is waiting for input. What they are referring to here is also more processing than memory. And in fact it leads into a couple of concepts coming up in the next assessment statement, "polling" and "interrupts". But one way or the other, the OS does have to help the CPU allot resources based on certain priorities. And taking the interrupt example, when an interrupt occurs in the CPU, the program associated with that interrupt needs to be in memory.


Complete Question & Model Answer

Finally, what if the one big question on your Paper 1 was:

"Outline the operating system's management of memory, for example, allocating storage and keeping track of programs in memory, swapping between programs on time-slicing, priority or when one is waiting for input. [5 marks]"

Model answer:

The OS manages memory in many ways. It allocates storage, i.e. putting files to the hard drive, and it also allocates running programs to RAM memory, and determines how much RAM each is allowed to use. Furthermore, during actual processing, parts of programs running in RAM memory will be swapped in and out of the CPU which "shares" processing of multiple applications via "time-slicing". Also, the CPU will swap in and out various processes based on priority (for example interrupts taking priority over normal user-lanuched programs), or when it is waiting for input and can work on background tasks such as indexing the hard drive.







JSR Notes - FORMER CURRICULUM - 6.3.1 Define operating system.

Ok, here’s a definition for you:

Operating System: A certain kind of system software that is required to run and operate your computer.  In fact, it is the interface between the hardware and the applications software or computers.  The most common operating systems on personal computers today are Windows XP, Vista, the Mac OS X, and all versions of UNIX. 

But an operating system is defined collectively, in fact by all of the various jobs that it does. 

But do keep in mind that there’s more to Window than Windows Explorer, and more to the Mac OS than the Finder application.  Both the Windows Explorer and Finder are application software that act as an interface between the user and the OS, rather than the OS which is an interface between the user’s applications and the hardware.  So the Windows Explorer and Finder are simply a very visible part of the whole Operating System.

So to get a more global understanding of what the OS is responsible for, go on to 6.3.2.


JSR Notes - FORMER CURRICULUM - 6.3.2 Explain the function of operating systems. :

And actually, in terms of satisfying the assessment statement, you can’t do much better than the above teaching note.  You should really have an understanding of what each of those things is, but listing them off as above would be a really good start.  Never-the-less, what follows is a bit more on each of them.  But a really good point to make here is that the following list is straight out of the syllabus, so it’s as good or better than any arrangement/order of the same things in the textbook; looking at and understanding both ways of putting it would be best.



Memory Management – All activities that are going on in the computer would take all of the RAM if they could, so something has to parcel out the memory in a fair, and efficient manner, prioritizing as it goes.

Software Execution Control – This is the management itself of what applications run, and when.

File Maintenance – This is all the lower level file organization that is required to keep things functioning properly.  The File Allocation Table, in particular has to be managed and maintained so that files are able to be found – and not just user files, but files used by the computer itself.

Virtual Memory Management – Virtual memory is the use of the hard drive as RAM memory; it’s obviously slower, but almost all applications do use virtual memory, though they continually swap in and out of RAM the most important information needed.



Input/Output (I/O) Control – There needs to be a software interface between all peripherals and the computer; so here we’re talking about management of communication between the computer and all sorts of peripherals, like mice, keyboards, and printers, to name a few.

Software/hardware interface – All applications have to be able to properly access the various hardware they need, to do what they do.  As does the operating system itself, in fact.

Drivers Management - Drivers are programs that operate specific hardware; the OS is responsible for interfacing with drivers, and making use of them.


User Level

File Management - This is the user-level management of user files and folders a la Windows Explorer on Windows machines or the Finder on Macs

User Interface – This is the Finder/Windows Explorer etc.  It allows the user to interact with the computer, and to set it up in an optimal way for his/her particular circumstances.

Security -  Everything from firewalls to user accounts to permissions are all part of this most important category of tasks.