The likelihood of deadlocks, livelocks, or races occurring increases dramatically on multitasking
(and multiuser) systems because the number of processes that are potentially competing for access
to a finite number of resources is greater. Good design, careful analysis, and the judicious use of
locks, semaphores, and other mutual exclusion (or mutex) mechanisms that mediate access to
shared resources, can prevent or reduce their occurrence.
Multiuser by Design
Linux is multiuser by design, an element of the Linux development model that has far-reaching
consequences for developers. A program cannot assume, for example, that it has sole access to any
resource such as a file, memory, peripheral devices, or CPU time; multiple programs might be
attempting to print simultaneously or trying to allocate memory.
Similarly, a program cannot be written with the assumption that only one copy of the program is
running at a time. So, if you are writing a program that creates temporary working files in /tmp,
you need to ensure that the temporary files created by Bubba??™s copy of the program are distinct
from the temporary files created by Mary Beth??™s instance of the program. If you don't, hilarity will
ensue (if not hilarity, at least confusion and consternation).
Pages:
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378