The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes threads - interaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "threads - interaction" Watch "threads - interaction" New topic

threads - interaction

timo corn
Ranch Hand

Joined: Oct 26, 2013
Posts: 68

Can you explain the following sentences taken from kb page 747:
This design is not optimal because the user can't do anything while the machine
is busy and while there are other shapes to define. We need to improve the situation.
A simple solution is to separate the processes into two different threads, one of
them interacting with the user and another managing the hardware. The user thread
sends the instructions to the hardware thread and then goes back to interacting with
the user immediately. The hardware thread receives the instructions from the user
thread and starts directing the machine immediately. Both threads use a common
object to communicate, which holds the current design being processed.

The user sends instr. to hardware and then goes back to interacting with the user? Does it mean interact with other users? Is the idea of threads like ajax in javascript where a client request is send to the server, then other jobs are done by client and when the server finishes it calls the client (back)? So the client does not have to wait.

Is the operator the user? The other thread is the machine/hardware. The idea here is that there is no third object (like in the bank account example) right? Two threads need each other and interact.

I agree. Here's the link:
subject: threads - interaction
It's not a secret anymore!