The Linux Programming Interface
POSIX Semaphores 1097 Listing 53-4: Using sem_post() to increment a POSIX semaphore –––––––––––––––––––––––––––––––––––––––––––– ...
1098 Chapter 53 The program in Listing 53-5 uses sem_getvalue() to retrieve the value of the semaphore named in its command-line ...
POSIX Semaphores 1099 We then execute a command that increments the semaphore. This causes the blocked sem_wait() in the backgro ...
1100 Chapter 53 z If we are building a dynamic data structure (e.g., a binary tree), each of whose items requires an associated ...
POSIX Semaphores 1101 The NPTL sem_init() implementation ignores pshared, since no special action is required for either type of ...
1102 Chapter 53 loc = glob; loc++; glob = loc; if (sem_post(&sem) == -1) errExit("sem_post"); } return NULL; } int main(int ...
POSIX Semaphores 1103 After an unnamed semaphore segment has been destroyed with sem_destroy(), it can be reinitialized with sem ...
1104 Chapter 53 proceed without blocking), then POSIX semaphores perform considerably bet- ter than System V semaphores. (On the ...
POSIX Semaphores 1105 SEM_VALUE_MAX This is the maximum value that a POSIX semaphore may reach. Sema- phores may assume any valu ...
...
POSIX SHARED MEMORY In previous chapters, we looked at two techniques that allow unrelated processes to share memory regions in ...
1108 Chapter 54 54.1 Overview POSIX shared memory allows to us to share a mapped region between unrelated processes without need ...
POSIX Shared Memory 1109 54.2 Creating Shared Memory Objects The shm_open() function creates and opens a new shared memory objec ...
1110 Chapter 54 against the process umask (Section 15.4.6). Unlike open(), the mode argument is always required for a call to sh ...
POSIX Shared Memory 1111 static void usageError(const char *progName) { fprintf(stderr, "Usage: %s [-cx] name size [octal-perms] ...
1112 Chapter 54 54.3 Using Shared Memory Objects Listing 54-2 and Listing 54-3 demonstrate the use of a shared memory object to ...
POSIX Shared Memory 1113 Listing 54-3: Copying data from a POSIX shared memory object –––––––––––––––––––––––––––––––––––––––––– ...
1114 Chapter 54 From the output, we can see that the program resized the shared memory object so that it is large enough to hold ...
POSIX Shared Memory 1115 54.5 Comparisons Between Shared Memory APIs By now, we have considered a number of different techniques ...
1116 Chapter 54 z Historically, System V shared memory was more widely available than mmap() and POSIX shared memory, although m ...
«
53
54
55
56
57
58
59
60
61
62
»
Free download pdf