From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: fdd80,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: ffc31,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: 1164f8,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Attributes: gide311f70d09,gidf4c4f7386e,gidd180ab3bd8,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.73.229 with SMTP id o5mr4624453pbv.7.1329423357868; Thu, 16 Feb 2012 12:15:57 -0800 (PST) Path: wr5ni33009pbc.0!nntp.google.com!news2.google.com!eweka.nl!lightspeed.eweka.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.stack.nl!newsfeed.Update.UU.SE!news.Update.UU.SE!not-for-mail From: Johnny Billquist Newsgroups: alt.sys.pdp11,vmsnet.pdp-11,comp.sys.dec Subject: Re: PDP11 Values from MFPT Date: Thu, 16 Feb 2012 21:15:55 +0100 Organization: Update Computer Club Message-ID: References: <4f360d68.39000374@nntp.aioe.org> <4f396a03.27713593@nntp.aioe.org> <4f37ec05.63303162@nntp.aioe.org> <4f3a87d9.14307647@nntp.aioe.org> <4f3ca414.21534066@nntp.aioe.org> <4f3dab02.35785786@nntp.aioe.org> <4f3d06f0.6951576@nntp.aioe.org> NNTP-Posting-Host: 2620:0:105f:b:462a:60ff:fefb:aad8 Mime-Version: 1.0 X-Trace: Iltempo.Update.UU.SE 1329423357 25098 2620:0:105f:b:462a:60ff:fefb:aad8 (16 Feb 2012 20:15:57 GMT) X-Complaints-To: newsmaster@Update.UU.SE NNTP-Posting-Date: Thu, 16 Feb 2012 20:15:57 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 In-Reply-To: <4f3d06f0.6951576@nntp.aioe.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-02-16 14.54, paramucho wrote: > On Wed, 15 Feb 2012 18:12:33 +0100, Johnny Billquist > wrote: > > >> It is only a problem in kernel mode. And I've not yet seen anything that >> convinces me that allowing page faults in kernel mode gains you >> anything, but can cost you a lot. > >> What do you expect do to if you get a page fault in kernel mode? >> Suspend the execution of something in kernel mode while the page is >> being read in, in order to be able to restart the execution. This >> becomes very messy, since this means you need to be able to suspend >> execution at random places in the kernel. > > Nothing random about it at all. There are key points of contact with > processes, each having it's own specific reason. At present I manage > some of these contact points with MFPx/MFTx, in other places by > mapping a kernel window. In either situation I will be able to choose > if I want to lock a page in advance or not. It's not much more > complicated than the current situation (where each point of contact is > expected to care of unexpected errors anyway). There are a whole bunch of them, though, and for different reasons, and under different conditions. You basically want to be able to handle page faults at those points. I prefer that the kernel does explicit control when it tries to do such stuff, and do it in advance. And then have a controlled behavior when/if memory is not paged in. You prefer to handle page faults in the kernel. >> I simply does not think that is a good idea. > >> Instead having page faults possible in the kernel comes with other >> costs, which are much higher, I think. > > We simply disagree on the issue of kernel page faults. I'm perfectly fine with disagreeing on this then. >>>> And as for "across the access", I'm not really fond of the Unix way of >>>> having user processed get bogged down in the kernel and being preempted >>>> and suspended in kernel mode. I prefer having all the service by the >>>> kernel be finished immediately, and get back out to userland, and wait >>>> there. So you need to be sure that what you are going to access is >>>> available in the beginning, and after that, it will stay around until >>>> your piece of service is finished. No additional checks. > > >> Yes, system calls are handled in the kernel in RSX, and are run to >> completion before normal scheduling can continue. However, all system >> calls are really just performing one thing, which always is known to be >> able to run from start to finish without blocking or having other >> issues, so system calls never really block anything. System calls are at >> the same level as forks, and of course you cannot allow two system >> calls, or fork processes to run simultaneously, since that would mean >> you get data corruption in the kernel. > > It was a great idea when RSX was very young and a simple multi-tasking > system. As a grown-up general-purpose O/S I think the approach > involves some serious limitations. While I'm certain that the earlier > systm calls were in and out of the kernel pretty quickly I'm not sure > that that's the case for a lot of the later directives. I can't really think of any system call that really need to sit in the kernel for extended periods. I really do think that is a bad idea, and that is what Unix prefers. >>> RT-11, RUST/XM and VMS control preemption entirely through >>> mutexs/semaphores etc and system state. The kernel code which >>> implements system calls for processes is just as preemptable as user >>> mode code (and is reentrant). Anything less than that would seem >>> pretty antiquated to me. >> >> RT-11 does no such thing. I remember having this discussion in the past >> (with you?). Whenever any one program enters USR, all other calls will >> be blocking until the first called exits USR again, and then one other >> process can enter that whole thing. So only one program at a time can >> for example create a file, or use the command line parser. > > I don't think your previous "discussion" was with me, or least I hope > it wasn't, because the view you present is completely inaccurate. I don't remember who it was with. Not important anyway. > The "USR" is to RT-11 what the "F11ACP" is to RSX. You can't describe > the scheduling dynamics of the RSX kernel on the basis of the F11ACP > behavior and you can't describe RT-11's scheduling dynamics on the > basis of the USR behavior. They're quite different things. F11ACP is a process, scheduled just like any other process. And you are allowed to have as many of them as you want. > The RT-11 USR is a sub-system which handles ACP-like services, driver > fetch and the like. Access to the USR (ACP) is queued on a system-wide > basis. I am not sure whether the RSX F11ACP is single-threaded for all > devices or not. It is hard to describe F11ACP in that way. First of all, you are allowed to have several F11ACP running, one for each device if you want to. Second, it is not really single-threaded as such. It is threading on a device level, though. You cannot have several opens or creates going on in parallel on a single device. The first file needs to be created before the second one can, for example (almost an obvious comment, but anyway...) But you can have several creates being done on different devices at the same time. The reason for wanting to have a separate F11ACP for your device is caching. F11ACP cache file headers, but there is only so much caching that can be done in one process. Having a separate process allows it to have a separate cache, since this cache is held in the process memory. > The RT-11 CSI (Command String Interpreter) was originally located in > the USR. These days, in multi-tasking RT-11, initial CSI processing is > handled outside the USR. Programs don't have to queue for command > processing. Looking at the source, it would appear that anyone calling anything related to USR will lock everything else out from calling USR. I can see CSI in there, but it might be that some additional trickery is located somewhere. But it's way more locking things out than RSX ever does. Not to mention that a process doing a call to open or create a file actually is not blocked in RSX. It can continue running happily on for ever before that call completes. >> But to be clear, RSX protects the whole kernel through a lock, and does >> not depend on system state or processor priority levels (apart from the >> actual lock operations, which are using the IPL itself to protect them). >> Which is why adding MP to RSX was also a rather simple operation. > > By "system state" I mean basically the same state as "fork state". In > RSX that also involves a switch to the "system stack". System state > runs at IPL 0. $DIRSV switches to system state. Ah. $DIRSV in RSX is the way you get to "system state" from a user mode system call. You can also get there through an interrupt, which then gets through $INTSI. In reality, the "system state" is visible as the stack depth value. When it is 0, you are in system state. If it's +1 you are in user mode, and if it is <0, you are in an interrupt handler. Anything <1 means you are in kernel mode. (You can also get there through $INTSC, $INTSE and $INTSV) >> RT-11 plays with the IPL at various places to protect code which is >> sensitive. > > RT-11 uses IPL for hardware synchonisation in just the same way that > RSX does. The fork routine is a good example. Here's the RSX code. > > $FORK0::MOV (SP)+,-(R4) ;SET FORK PC > CLR -(R4) ;CLEAR LINK TO NEXT FORK BLOCK > MFPS -(SP) ;SAVE CURRENT PROCESSOR PRIORITY > MTPS #PR7 ;;;LOCK OUT INTERRUPTS > MOV R4,@$FRKHD+2 ;;;LINK NEW ENTRY TO OLD LAST > MOV R4,$FRKHD+2 ;;;SET ADDRESS OF NEW LAST > MTPS (SP)+ ;;;RESTORE PROCESSOR PRIORITY The fork routine does not run with raised IPL. It's only the enquing/dequeing of the fork block that is protected by the IPL, just like I said. And that is also the part that have to have even more protection if you have an MP system, since even IPL will not protect you enough. I suspect you looked at 11M and not MP again here, right? (Or else a rather old version of RSX.) > And RT-11 implements some queue operations by blocking IPL briefly: > > MARKTM::TST (R5)+ ;Point to avail header > SPL 7 ;Get element at PRIO 7 > MOV @R5,R3 ;;; Get element > BEQ 60$ ;;; None there, error > MOV @R3,@R5 ;;; Link avail queue forward > SPL 0 ;;; Yes. Exactly. And all of that kind of operations are in RSX done at the fork level, without IPL protection, because it is not needed. That's what the forks are for. If RT-11 don't use forks for this, what do RT-11 use forks for? > However, the primary tool that RT-11 uses for system (scheduler) > synchronisation is ENSYS, which switches to system state (fork state). > There are about twenty calls to $ENSYS in the resident monitor. Yes, I can see a bunch of calls to ENSYS. And as far as I can tell, ENSYS raises the SPL to 7, before coming back to where it was invoked. Locking out all interrupts every time. Each routine can then, when it suitable, drop the IPL. There is also this FRK routine, which I assumed was how you created a fork in RT-11, but I might have missed something. The only thing calling FRK is SP.MAC, that I can see. > The idea that RT-11 manages system synchronisation via IPL is simply > wrong. System state and queues are used to manage synchronisation. I obviously find it different when looking. ENSYS uses the IPL (always raising it to 7). Various functions like the mark time uses the IPL to protect structures. I didn't say "synchronization", but "protection". You can find it in lots of places, like I said. >> VMS is basically working the same way as RSX in most places, but adapted >> to the different memory subsystem of the VAX. Which means you don't have >> different address spaces for different modes. And of course, you have >> paging, and there are some rather more synchronous services in there in >> some places. > > When talking about system calls, I don't know how you can say that VMS > works basically like RSX unless you can assert that VMS executes > system calls, from start to finish, in system state (i.e. at fork > level), and that's just not the case. Scheduling is not blocked for > the duration of a VMS system calls as it is for an RSX system call. > That's a fundamental difference. What system calls does not complete immediately in VMS? Honestly asking since I don't know the answer myself, and cannot think of any straight off my head. > VMS and RT-11 take the same approach. Processing of a aystem service > does not initially alter the process scheduling state. System state is > used selectively, usually for short periods, when synchronisation is > required. Further, both systems are reentrant: RT-11 and VMS system > call code can issue system calls. RSX system call code cannot. Are you sure you are not mixing up the kernel with DCL, RMS and libraries in VMS here? > The architecture of the RUST/XM kernel was based on a mixture of VMS > and RT-11. There were few problems harmonising the two systems because > they are fundamentally similar. Indeed, the system dynamics of RT-11, > RUST/XM, RSX and VMS are constructed using the same building blocks. > The principal difference is that RSX puts a system state wrapper > around its system calls where the other systems do not. VMS is very closely engineered like RSX in so many ways that I would find it odd if you could substantiate that it works more like RT-11. But I have been surprised before, and am ready for it again. Johnny