Question
Write a program that accepts an integer N as a command line input and then proceeds to launch N threads within that process. Each process
Write a program that accepts an integer N as a command line input and then proceeds to launch N threads within that process. Each process should consist of an infinite loop that prints out Thread k running (once every second) where k is a process index (from 0 to N-1). After 5 seconds of running, your main program should kill process 0, then after another 5 seconds, should kill process 1, and so on until all processes have been terminated. At that time, your main program should itself terminate.solution to these problems should be written in C or C++ for Linux/windows.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started