Last active
July 8, 2021 06:26
-
-
Save way2datta/f9ced8c13eccbcb03f49d50b06f73647 to your computer and use it in GitHub Desktop.
This program will be used to show "Running Many Programs At Once"
This file contains 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
using System; | |
using System.Diagnostics; | |
using System.Runtime.InteropServices; | |
using System.Security; | |
using System.Threading; | |
internal class Program | |
{ | |
[DllImport("Kernel32.dll"), SuppressUnmanagedCodeSecurity] | |
public static extern int GetCurrentProcessorNumber(); | |
private static void Main() | |
{ | |
var currentProcess = Process.GetCurrentProcess(); | |
Console.WriteLine($"Please enter any string for process {currentProcess.Id} which is executed by {GetCurrentProcessorNumber()}: "); | |
var readline = Console.ReadLine(); | |
var i = 0; | |
while (i++ < 12) | |
{ | |
Console.WriteLine($"For process {currentProcess.Id} which is executed by {GetCurrentProcessorNumber()}, you have entered: {readline}"); | |
Thread.Sleep(1000); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment