tailieunhanh - distributed operating system phần 2

Tham khảo tài liệu 'distributed operating system phần 2', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 60 COMMUNICATION IN DISTRIBUTED SYSTEMS CHAP. 2 There are two possible ways out. The first solution is to have the kernel copy the message to an internal kernel buffer and then allow the process to continue as shown in Fig. 2-11 b . From the sender s point of view this scheme is the same as a blocking call as soon as it gets control back it is free to reuse the buffer. Of course the message will not yet have been sent but the sender is not hindered by this fact. The disadvantage of this method is that every outgoing message has to be copied from user space to kernel space. With many network interfaces the message will have to be copied to a hardware transmission buffer later anyway so the first copy is essentially wasted. The extra copy can reduce the performance of the system considerably. The second solution is to interrupt the sender when the message has been sent to inform it that the buffer is once again available. No copy is required here which saves time but user-level interrupts make programming tricky difficult and subject to race conditions which makes them irreproducible. Most experts agree that although this method is highly efficient and allows the most parallelism the disadvantages greatly outweigh the advantages programs based on interrupts are difficult to write correctly and nearly impossible to debug when they are wrong. Sometimes the interrupt can be disguised by starting up a new thread of control to discussed in Chap. 4 within the sender s address space. Although this is somewhat cleaner than a raw interrupt it is still far more complicated than synchronous communication. If only a single thread of control is available the choices come down to 1. Blocking send CPU idle during message transmission . 2. Nonblocking send with copy CPU time wasted for the extra copy . 3. Nonblocking send with interrupt makes programming difficult . Under normal conditions the first choice is the best. It does not maximize the parallelism but is simple to understand

TỪ KHÓA LIÊN QUAN