process or thread???

Hi,

I’m working on a multithread application. I’ve got exactly four tasks to go.
The first task is to talk to hardware via parallel port, the second and third are to talk to hardware via serial ports, the last task is to manage the first three tasks. The question is: should I use processes or threads to do that? What would be better? Should I place all four tasks in separate threads or place them in separete processes?

Cheers.

I would only use one process with one thread. For the serial port you’d talk to the serial port driver (/dev/ser*). For the parallele port you may have to write a driver since I don’t beleive /dev/par! handles input, not sure.

The process would be event based and output data to the devices when it needs to and wake up when a device received data.

Thanks mario!

Or in another approach you could implement the Resource Manager for handling all these devices.

Why? These devices already have resource managers, (except paralle port in input model) why write a resource manager of already existing resource manager. Unless I’m missing something?

You will have multiple threads running, so the question is whether to have them all in one process or each in their own separate process.
Given that you will be running at parallel port and serial speeds, there is no need for shared memory access to the data. In this case, separate processes are suggested as this protects each threads data. It also might make your design modular at the process level, in case you want to later add, say a TCP/IP or USB input/output.