Download Unix system programming in OCaml
Transcript
Contents 5.2 5.3 5.4 5.5 5.6 5.7 Complete example: parallel sieve of Eratosthenes Named pipes 64 Descriptor redirections 64 Complete example: composing N commands 67 Input/output multiplexing 68 Miscellaneous: write 73 6 Modern communication: sockets 77 6.1 Sockets 78 6.2 Socket creation 79 6.3 Addresses 80 6.4 Connection to a server 81 6.5 Disconnecting sockets 81 6.6 Complete example: the universal client 6.7 Establishing a service 83 6.8 Tuning sockets 86 6.9 Complete example: the universal server 6.10 Communication in connectionless mode 6.11 Low level reads and writes 89 6.12 High-level primitives 89 6.13 Examples of protocols 90 6.14 Complete example: http requests 94 81 86 88 7 Threads 101 7.1 Introduction 101 7.2 Creation and termination of threads 102 7.3 Waiting 103 7.4 Synchronization among threads: locks 107 7.5 Complete example: http relay 109 7.6 Conditions 111 7.7 Event-based synchronous communication 113 7.8 Implementation details 116 Going further 119 Exercise answers References Index ii 137 135 121 61