From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,1600804756a0bd88 X-Google-Attributes: gidfc89c,public X-Google-Thread: fb4a0,1600804756a0bd88 X-Google-Attributes: gidfb4a0,public X-Google-Thread: 11035d,1600804756a0bd88 X-Google-Attributes: gid11035d,public X-Google-Thread: fee84,1600804756a0bd88 X-Google-Attributes: gidfee84,public X-Google-Thread: 10c665,1600804756a0bd88 X-Google-Attributes: gid10c665,public X-Google-Thread: 10650a,1600804756a0bd88 X-Google-Attributes: gid10650a,public From: jdickson@vtol.jpl.nasa.gov (Jeff Dickson) Subject: Re: Threads on different unix systems Date: 1995/07/11 Message-ID: <3tupf3$4j3@vtol.jpl.nasa.gov>#1/1 X-Deja-AN: 106000290 distribution: inet references: <805320887snz@cucumber.demon.co.uk> <3tt6qc$e4t@newsbf02.news.aol.com> <3ttg7h$dkh@engnews2.eng.sun.com> content-type: text/plain; charset=US-ASCII organization: Jet Propulsion Laboratory - Pasadena CA mime-version: 1.0 newsgroups: comp.unix.internals,comp.unix.sys5.r4,comp.unix.osf.osf1,comp.unix.solaris,comp.unix.unixware,comp.unix.programmer In article <3ttg7h$dkh@engnews2.eng.sun.com> Casper.Dik@Holland.Sun.COM (Casper H.S. Dik - Network Security Engineer) writes: > >interbase@aol.com (Interbase) writes: > >>If indeed you do use the underlying system call - read() in this case - >>then yes, the process would block. One approach to handling I/O so that >>other threads run (without kernel support) would be to use the select() >>or poll() system calls to determine when I/O can be done. The library >>can then suspend a thread which requests I/O, do the I/O when the >>select() or poll() call indicates that it is possible, and re- schedule >>the thread afterward. To prevent blocking in certain cases, each opened >>file descriptor can be marked as non- blocking. For the case where a >>non-blocking call returns a partially filled request under conditions in >>which the blocking equivalent would not, the library would need some >>additional logic to preserve the proper semantics. > >Of course there are many advantages to kernel threads over non-kernel >threads: > - if one thread blocks on a short-term read (normal file read, > wait for disk I/O) another thread can get scheduled. > - if one thread gets a page fault, other threads can continue > - if you have multiple processors, your threads can use them > >Casper >-- To overcome the negative effects of disk I/O why not use asynchronous reads and writes? The aio_result_t structure whose address is passed to the read and write functions and returned by aiowait() could be appended with infor- mation that identified the particular thread from which the operation orig- inated. Of course not all platforms support asynchronous I/O, but it'd be silly to not take advantage of that if it were available. Jeff S. Dickson jdickson@vtol.jpl.nasa.gov