Have you ever wondered how the computer understands and executes instructions correctly when a user is interacting with it ? When a user saves a file how does the computer hard disk memory understand what file to save, where to save the file and how to save it? This is the function or one of the functions of an operating system.
An operating system is a program that manages the computer hardware. The computer hardware includes physical parts of a computer like the mouse and keyboard. The operating system acts as an intermediary and an interface between the computer hardware and the user. The user here is an instance of an application software. Application softwares are programs designed for end users that helps to perform a specific task. Microsoft word help you format a document, web browsers help you connect to the internet, music players and video players help you play music and video files. Microsoft word running, web browser running on your pc represents a user. The operating system acts as a communication bridge between the computer hardware and the user. It manages and coordinates the computer hardware. The computer hardware(Memory disk, keyboard, mouse) understand the binary language only (0s and 1s). The operating system help to translate and interpret user's instructions to the computer hardware.
Without the operating system, every user has to clearly explain clearly to the computer hardware what to do and how to do it. Without the OS, a user trying to create a document of the Microsoft word, has to: Tell the central processing unit to load up the Microsoft word in memory, instruct the monitor to display document on screen and after, explain to the hard disk how and where to save the file. Considering the fact that hardware components of the computer only understand the binary language, this means user has to pass these instructions to it in that form(0s and 1s). For each and every task performed on a computer without an operating system, the user has to explicitly explain to the hardware component what to do and how to do it. This becomes a very tedious task and the computer would not be as accessible as it is today.
When a someone double clicks on an icon, the Operating system explains to the hardware, what that means(what the person intends to do), what must be done in order to achieve that and how to do what must be done. Say a typist wants to save her file after she's done typing. She clicks on the save command and the operating system explains to the computer hardware what to save, where to save and how to save. Examples of operating systems include Windows, Linux, Android, Mac OS, Ubuntu.
The operating system performs other functions like allocation of resources(memory, processors).
Functions of the Operating System include
- Process Management.
- Memory Management.
- I/O Management.
- Security
Process Management
A process is a program in execution. For any program to execute, it needs access to some resources of the computer system. The operating system helps to load up a program and allocates needed resources to that program. We have an application software which is to help the user perform a task. Before the software is executed it is just a program. Immediately, the program is fired up and loaded in memory it becomes a process. A software can also run more than one process. To run an instance of the google chrome browser there are multiple processes running in the background. Computers allow many processes to run at once. The operating system is responsible for effectively managing those processes and distributing computer resources among them. A thread is a unit of execution within a process. Just in case you're new to the term threads I will be writing about them in my next post. Process management involves various tasks like creation, scheduling and termination of processes. The Operating system also allows a process to exchange information with other processes. Aside from allocation of resources to processes the operating system also helps in process scheduling.
There are seven main stages of a process execution:
- New: This is when a specific program is initially called up from the secondary memory(Hard disk) and loaded to the primary memory RAM.
- Ready: In this state, the program has been loaded into the RAM by the operating system and is waiting to be executed.
- Waiting: In the waiting state, the process is waiting for allocation of computer resources to it by the operating system. Resources like CPU time, memory .
- Execution: This is a process already in the execution state.
- Blocked: It is a time interval when a process is waiting for an event like I/O operations to complete. A process that is blocked, is waiting for some resources to be released to it or waiting for the completion of an I/O operation. An I/O (Input Output) Operation is an operation that includes communication between an Information processing system and a user.
- Suspended: Suspended state defines the time when a process is ready for execution but has not been placed in the ready queue by Operating System. When all the processes in main memory are in the Blocked state, the operating system can suspended one process by putting it in the Suspended state and transferring it to disk. The space that is freed up in the memory can then be used to bring in another process. It can admit a newly created process, or it can bring in a previously suspended process.
- Terminated: Terminated state specifies the time when a process is terminated or killed.
Memory Management
Memory management is the function of the operating system which handles or manages primary memory(RAM) and moves processes back and forth between primary memory and disk during execution. The operating system also keeps track of every memory location on the system. It tracks how much memory is allocated to a process.
The operating system is instrumental in the usability and accessibility of modern computers.