Part to Understanding Operating Process & Multiprocessing
The most central concept of an operating system is the process and how its managed. A process is a software abstraction of the hardware processor (CPU) and a powerful and interesting feature of an operating system.
The concept of multi-processing in a single core CPU is an operating system software idea. The timing trick behind the execution of multiple processes can be achieve with the help of the processor clock interrupts.
The clock interrupts of processor is use for the interruption of an executing processor or CPU, in other for the process scheduler to swap another process for execution. This process of swapping process to another process is called context switching. This is one of the reason why clock interrupt are very important feature of a processor or micro-controller.
The understanding of clock interrupt require a whole chapter of textbook if not a book, but the idea in terms of process scheduling is to interrupt the processor within a period of time slice.
For this reason above, the clock interrupt are therefore the first thing to be program or configured before allowing a process to run. This is the only way to stop or interrupt the currently running process being executed by the processor. This gives the operating system the ability to allocate or reconfigured the clock interrupt and slice different time for interruption, depending on the processor scheduler algorithm implementation.
Note: The clock interrupt event will always happen even if the process is in an infinite loop. The clock interrupts sub-routine can then be use to carryout process context switching by coping the current states of the processor to a data structure called the Process Control Block( Data structure for storing information about the state of a processor).
Maybe further article, I will also try and write about hardware interrupts and the CPU clock interrupt or below list.
- Processors & Process communication concepts
- Concept of Paging
- Clock Interrupts
- Process and Thread Scheduling
- Memory Management
- File System
- Operating Kernel
- Device Management
A good knowledge of how this features are implement is a plus to the understanding of what really goes on, on one's machine and how to better take advantages of the provided features during coding or merely using the machine.
Finally, An operating is a complex software that abstract and maintain the current state of a machine may-while, a process is the smallest unit of a task that an operating or a processor can run at a giving time. Therefore to make a machine general purpose computer. An operating have to provide a way to load a process into memory.
Moreover, operating system are response to provide inter-process communication and memory sharing mechanism, therefore a threaded application in python or C++ have to use the native window or linux thread to be able to utilised the CPU threading features.
from multiprocessing import Process;
import os;
Create the entry point of the new process
def entryPoint():
print('child = {0}'.format(os.getpid()));
Create a process object and set the target subroutine which is the entry point.
if(__name__ == '__main__'):
process1 = Process(target= entryPoint);
process1.start();
print("parent = {0}".format(os.getpid()));
Thanks for your time and hope you enjoy it.