Path: news.daimi.aau.dk!poe From: S|ren Brandt Newsgroups: comp.lang.beta Subject: Re: asynchronous communication Date: 11 May 1995 11:14:43 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 73 Approved: mailtonews@daimi.aau.dk Distribution: world Message-ID: <3osrj3$h6p@belfort.daimi.aau.dk> NNTP-Posting-Host: daimi.daimi.aau.dk > > Is asynchronous communication possible between processes > in the Mjolner BETA System? > > [BM94], section 5.1 'Synchronous versus asynchronous communication': > > async: (# theTread: @| (# do this(async) #); > forked : @Boolean; > do (if not forked//TRUE then > true -> forked; > theTread.fork; > else > INNER > if) > #); > > do async(# do (a,b) -> server.foo #); > > Does this really work even if concurrency is just simulated > by non-preemptive multitasking? > > - The Distribution Reference Manual states, that if one component > of a process makes a blocking call then the whole process is blocked > (and all components within) [MIA 91-20], sec.6.3, p.20. A "blocking call" here means "blocking OS call". This is no more than the usual problem of thread packages implemented in user-space, as opposed to operating system threads, i.e. kernel threads. The trouble with user-level threads is that the operating system does not know about them, and therefore blocks the entire process if one of the user-level threads does a blocking system call. In BETA on UNIX, as well as in probably all other UNIX based user-level thread packages, this problem is handled by converting all system calls into non-blocking calls, and doing "synchronous I/O multiplexing", using the "select" system call (man select). This has been done for all system calls used in the distribution library. To see how to do the same thing in your own libraries, check out the fragment ~beta/unixlib/v1.4/iostate.bet providing an interface to "select". > > - The calling system (the component executing fork?) keeps control > [MIA 90-08], sec.11.3, p.100. Does this mean, that the INNER > (= the synchronous communication imperative) is delayed until > the calling process is suspended? Yep. To make async do "the right thing" with the current implementation of systemenv, change it into: ORIGIN '~beta/basiclib/v1.4/basicsystemenv'; ---systemlib:attributes--- async: (# theTread: @| System (# do this(async) #); forked: @Boolean; do (if not forked then true->forked; theTread[]->fork; pause; pause; else INNER if) #); > > I would be happy if you could help me to understand this. Hope this helps. -- Soren