5 Operating System Concepts You Should Know As a Developer
Being a developer you might have focused your skills on problem-solving and data structure. Well, no doubt this is one of the most essential skills. Apart from that have you ever tried to know what else is more important? Consider a scenario that you’re executing a code, but your program runs too slowly. You check your code, and you find that there is nothing wrong with your code. What could be the reason behind this?
Well, one of the reasons could be your operating system. Now if you need to debug your program then how would you do that if you don’t know how your operating system works. Possibilities are there that you’re accessing too many files, you’re running out of memory or swap is in high usage. To resolve this issue surely you need to know about the swap or I/O blocking.
How will you communicate with your machine? Will you prefer locally, or you will do that on the internet? Have you ever tried to know that why some programmers prefer one OS over another?
From all the above conversations, you might have understood that why it is important to learn operating systems. Being a developer we should understand the importance of the operating systems. Today in this blog, we are going to discuss some important concepts of the operating systems that will help in your job as a developer.
1. Process and Process Management
The process is basically defined as a program in execution. The process should be executed sequentially. When you write a computer program in a text file and when you execute this program it becomes a process in your system. This process performs all the tasks mentioned in the program. A process is divided mainly into four sections: Stack, heap, text, and data.
- Stack: Stack is responsible for storing temporary data such as functions/method parameters. It returns address and local variables.
- Heap: Heap allocates the memory to a process dynamically during its runtime.
- Text: Text includes the current activity represented by the values of the program counter and data stored in the processor’s register.
- Data: It contains the global and static variables.
A process passes through mainly with five different states… Start, Ready, Running, Waiting, Terminated, or Exit.
2. Concept of Threads
You can define thread as a flow of execution through the process code. The thread keep the track of all the instructions that need to be executed next in the program counter. Also, the thread contains system registers that hold the current working variables. In the thread, the stack contains the execution history.
Thread can share code segment, data segment, and open files with its peer thread. When a code segment is altered by one thread, all the other threads see that. Thread is also called a lightweight process. The performance of the application can be improved through parallelism.
One thread belongs to exactly one process and none of the thread can exist outside a process. Threads are generally used in implementing web servers and network servers. Mainly there are two kinds of thread…
User Level Thread: In this level of thread, the thread management kernel is not aware of the existence of threads. The Thread library also maintains the code to create and destroy the thread. It also contains the code for passing messages and data between threads. Code is also maintained for scheduling thread execution and for restoring thread context.
Kernel Level Thread: Thread-level management is done by the kernel. In the application area, you won’t find the thread management code. It is supported directly by the operating system.
The kernel also maintains the context information for the individual threads and for the processes as a whole. Scheduling is also done on a thread basis. The kernel is responsible for creating, scheduling, and managing the kernel space.
In scheduling, the process manager takes the responsibility to remove the running process from the CPU, also it chooses another process based on a specific strategy. For multiprogramming operating system scheduling is the essential part. At a time more than one process can be loaded into the executable memory. The process shares the CPU using time multiplexing once it gets loaded.
In process scheduling queues operating system maintains all the process control blocks. A separate queue is maintained by the OS for each of the process states. Process control blocks of all the processes in the same execution state are maintained in the same queue.
Mainly your operating system maintains the following important process scheduling queue:
- Job queue: It takes the responsibility to keep all the processes in the system
- Ready queue: In the main memory all the processes reside which are ready and waiting to execute.
- Device queues: This queue stores the processes which are blocked due to the unavailability of an I/O device
4. Memory Management
Memory management refers to the functionality of an operating system that handles and manages the primary memory. Processes move back and forth between the main memory and the disk during the execution.
Memory locations get tracked by memory management. Every time it checks how much memory is allocated to processes. It also decides which process gets memory at what time. Also, it updates the status whenever a memory gets freed up or unallocated. The operating system maps the logical addresses to physical addresses at the time of memory allocation. Mainly there are three types of addresses used in a program…
- Symbolic addresses: It is used in the source code. The variable names, constants, and instructions labels are the basic elements of the symbolic address space.
- Relative addresses: During compilation, the compiler converts symbolic addresses into relative addresses.
- Physical addresses: The loader takes the responsibility to generate these addresses at the time when the program gets loaded into the main memory.
5. Inter-Process Communication
In an operating system, processes get divided into two types: Independent and Cooperating. Independent processes don’t get affected by the execution of other processes. A cooperating process gets affected by the other executing process.
Independent processes execute efficiently and in these situations, their cooperative nature is utilized for increasing computational speed, convenience, and modularity. In this mechanism, processes are allowed to communicate with each other. Communication is seen as a method of cooperation between them.
Please Login to comment...