Multitasking in operating systems allows multiple tasks to run in an concurrent (or interleaved) manner, enhancing system performance.
Multiprogramming ensures that the CPU (a very fast device) is used by other processes when one process becomes busy with IO (very slow compared to CPU). Multitasking further enhances multiprograamming by allocating fixed slot to each process ready to execute. It mainly runs processes in round robin manner.
We mainly try to make the best utilization of our main resource which is CPU (by allowing processes to run in an interleaved manner (one process gets CPU for a partial time and then other process gets CPU).
Apart from CPU utilization, it also improves user experience as the system becomes more responsive and interactive, hence allows user to do multiple tasks.
Time Sharing: In this, many processes are allocated with resources of computer in respective time slots, processors time is shared with multiple processes.
Context Switching: Context switching is a process of saving the context of one process and loading the context of another process. In simpler terms it is loading another process when the prior process has finished its execution.
Multi-Threading: Multithreading is the ability of a program or an operating system to enable more than one user at a time without requiring multiple copies of the program running on the computer.
Hardware Interrupt: When a process or an event requires urgent attention, hardware or software will signal with an interrupt. It informs the processor that a high-priority task has arisen that necessitates interrupting the running process.
Process Scheduling: It is the operating system mechanism that allocates CPU time to processes based on scheduling algorithms.
Process Synchronization: ensures coordinated access to shared resources, preventing conflicts between processes.
Pros of Multi-Tasking Operating System
Multi-Tasking Operating System is capable of executing multiple application simultaneously without slowing down the system.
Each process is assigned specific length of time(i.e time sharing), hence a process does not have to wait for longer duration to utilize CPU. Starvation of process is not found in these operating system.
A multitasking OS can effectively manage I/O devices, RAM, hard disks, CPUs and other computer resources.
In Multi-Tasking Operating a user is capable of executing multiple programs at the same time, such as games, browser, MS Word and other services.
Memory management is well-defined in multitasking operating systems. Because of this, the operating system does not grant any permission for unwanted apps to waste RAM.
Cons of Multi-Tasking Operating System
As a single processor is executing multiple processes at the same time then there will be load on CPU and CPU may gets heat up.
Computer system will be lagging if the processor is slow in Multi-Tasking Operating System while executing multiple programs simultaneously.
Main memory(RAM) have to store multiple processes during multi tasking so there can be memory boundation if the main memory is overloaded.