Prev | Current Page 272 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"


The Java programmer is protected from having to know the details of the underlying threading model of the
computer.
SYNCHRONIZATION
Often processes or threads must share access to the same information. For instance, imagine an application
where one thread, the server thread, adds requests to a list of pending tasks, and another thread, the worker
thread, reads from the list, removes the task from the list, and executes the task. Appreciate, too, that ???adding a
request to a list??? will require more than one machine instruction to accomplish; the list object must be
referenced, the address of the last element must be calculated, and some reference to the new task must be
calculated (perhaps the address of a String buffer) and stored in the appropriate list memory location. In addition,
CHAP. 6] OPERATING SYSTEMS 103
such an application will almost always limit the number of elements in the list so that a flood of requests will
not simply swamp the computer and leave no time or memory for processing requests. So the server thread will
also include a check to see if the number of pending requests is already at its maximum value; if so, the server
thread will wait until the worker thread can complete at least one of the tasks.


Pages:
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
poker online Dyskusja Nr7 maszyna smitha noclegi swinoujscie bwin bonus