In this blog post, you will witness how multi-core CPU executes different processes and do context switching.
We will use the following program, this program merely takes input from the user and prints input string after some time periodically.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I presume after compiling the above file, we get the output file: ‘OSPlayground.exe’.
Now open a command prompt and navigate to the path that contains the above binary. Run the following command and witness the magic.
Command to use: start /b OSPlayground && OSPlayground
Output:
The command prompt will ask you to enter the string a couple of times since we executed the program twice. I had inputted EARTH! for the first process from the command prompt and MARS! for another one.
The above program is executed on a multicore processor.
Welcome to BeingCraftsman — where software architecture is treated as a long-term responsibility. I’m a Software Architect and Cloud Lead based in Pune, India, with over a decade of experience designing scalable systems, guiding teams, and making practical engineering decisions. This space is about clarity in architecture, reliability in systems, and leadership that helps teams build software that lasts.
Leave a Reply