Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running 3 parallel command prompts in C

I am writing a program which runs 3 parallel processes, each one receiving commands from the user. But I need to run 3 command prompts, one for every process, and I'm not sure how that's coded in C.

like image 237
user1640377 Avatar asked Mar 24 '26 07:03

user1640377


1 Answers

To get that to work in a single terminal, you have to:

  1. Ensure that at most one of the three processes is reading at a time.
  2. Ensure that the prompt for the process that is reading is displayed (not the prompt for some other process).
  3. Ensure that the user is very alert and aware of what they're typing.

The first two are non-trivial technical problems requiring inter-process coordination (communication). The last is not soluble.

As a UI design, that sounds extremely ... sub-optimal.

If you use multiple terminals, then the process-level coordination issues go away; each process works with its own terminal window and the system handles the coordination. The user, though, has to switch between the different windows to enter the correct data now, so you still have problem 3. As a UI design, that still sounds ... sub-optimal.

like image 79
Jonathan Leffler Avatar answered Mar 26 '26 22:03

Jonathan Leffler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!