Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!think.com!hsdndev!cmcl2!lab!jai From: jai@lab.ultra.nyu.edu (Benchiao Jai) Newsgroups: comp.os.minix Subject: Re: (PC/AT) why not include 'sync' in keyboard.c (for rebooting?) Message-ID: <1991Apr15.210247.26781@cmcl2.nyu.edu> Date: 15 Apr 91 21:02:47 GMT References: <50809@nigel.ee.udel.edu> Sender: notes@cmcl2.nyu.edu (Notes Person) Organization: New York University Ultracomputer Research Lab Lines: 35 Nntp-Posting-Host: lab.ultra.nyu.edu In article <50809@nigel.ee.udel.edu> CRAWFORD_B%PLU.BITNET@cornellc.cit.cornell.edu (brian) writes: >C.v.W writes: > >"It is not allowed that drivers call FS or MM, this is against the MINIX > hierarchy." > >I thought Minix was layered as such: Level 1: Kernel; Level 2: Device >Drivers; Level 3: FS and MM; Level 4: user applications. I believe there >is a figure in the book to this effect. If this is the case, then device >drivers must communicate with either the file system or the memory manager >since they are a level directly above the drivers (if the driver needs to >communicate with an application, for example). The kernel can send a message to fs telling it to execute a sync, but this operation is not atomic, so other things may happen in between. Picture this: keyboard driver send sync request to fs fs sends a write request to disk task disk task executes the request and send SUSPEND to fs fs suspends keyboard task and fetches another request from user (this is possible since no higher priority tasks can be run at this moment) fs executes the new write request by putting the new data into buffer cache disk task replies OK fs revives keyboard task and send an OK reply keyboard proceeds to reboot BOOM! Buffer cache is still dirty. Two minor points. First, the first level is the task switcher. The kernel consists of this and device drivers. Second, the applications never know that there is such a thing called 'kernel', they just execute the system calls, which are handled by either MM or FS. Benchiao Jai jai@cs.nyu.edu