Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This program will be used to show "Running Many Programs At Once"
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