gsteckel@diag2.East.Sun.COM (Geoff Steckel - Sun BOS Software) (05/01/90)
>>Maybe I am as well. My understanding is that the linker has to link up the >>code in such a way that it can be swapped or demand paged. Not quite, but close. The choice is between an executable with all its code, including the library routines, in the file, or an executable which attaches to a shared library at run time. In both cases the OS pages, swaps, or whatver it feels like. The motivation is that sharing one copy of the standard libraries takes much less space in memory and on disk than separate library pieces in each program. The cost is some extra setup. The linker must either link in the correct library routines, or a set of stubs which correspond to the `well known' entry points in the shared library segment. I don't know exactly how SysV/386 handles this, but the stubs are either just absolute addresses or jumps to absolute addresses (perhaps via indirection, like through a table). At run time (again I don't know exactly how SysV/386 works, but some wizard can enlighten us) one of three things happens: 1) The executable is marked `uses shared library' and the OS automatically maps it in. 2) Part of the standard startup (like /lib/crt0.o) contains a system call to map in the appropriate library. 3) The first call to the library page faults, but the OS recognizes the address range and maps in the shared library. At a guess, #2 is what happens. Usually a code is stored by the linker in the executable to declare what version of the library the executable was linked against. Most systems check this code (either in the application or in the OS) at process startup and exit with an error if the program is being run with a library version older than the one which was used for linking. Whew. I hope this clarifies things a little. Any more exact information gratefully appreciated. geoff steckel (gwes@wjh12.harvard.EDU) (...!husc6!wjh12!omnivor!gws) Disclaimer: I am not affiliated with Sun Microsystems, despite the From: line. This posting is entirely the author's responsibility.
jca@pnet01.cts.com (John C. Archambeau) (05/03/90)
glenn@extro.ucc.su.OZ.AU (Glenn Geers) writes: >From article <2459@crash.cts.com>, by jca@pnet01.cts.com (John C. Archambeau): >> bill@bilver.UUCP (Bill Vermillion) writes: >>>In article <2413@crash.cts.com> jca@pnet01.cts.com (John C. Archambeau) writes: >>>>dlucy@tropez.UUCP (Doug Lucy) writes: >>>>>I'm using GNU's gcc 1.37.1 and gas 1.35 patched and compiled for >>>..... >>>>It should work since SCO Unix is binary compatable with SCO Xenix. Just don't >>>>expect the demand paging to kick in on Xenix processes. I believe you need a >>>>smarter linker such as the one for the SCO Unix Development System to have the >>>>demand paging work at all. >>> >>>If I am interpreting (or reading between the lines properly) you are saying >>>that the Development system doens't support creation of demand paged programs >>>in Xenix even though the OS does. >>> >>>I thought the paging was a function of the os and not the linkers. >>> >>>Or am I totally confused. >> >> Maybe I am as well. My understanding is that the linker has to link up the >> code in such a way that it can be swapped or demand paged. Keep in mind that >> I am only familiar with systems that only do swapping, not demand paging and >> if Xenix 386 does do it, I obviously have overlooked it. The only process >> that I see running is the swapper when I do a ps, of course, on systems that >> do demand paging, it has to be really loaded to kick in. >> >> Again, I may be completely wrong...and if I stuck my keyboard in my mouth, my >> apologies. > >Xenix 386 *DOES* demand page. If it didn't how could I run processes larger >than physical memory ? I have 3640kb available - subtract ~1Mb for the kernel >leaving 2640kb but my maximum process size is ~4500kb. >Why doesn't someone just do vmstat -s and look at the pagein/out stats that are >provided ? Maybe I'd better refine the question, what's the difference between ordinary swapping and demand paging? I've heard of systems having both and the demand pager kicking in when the swapper is heavily loaded. Or am I listening to misinformation? // JCA /* **--------------------------------------------------------------------------* ** Flames : /dev/null | Xenix is the ONLY thing ** ARPANET : crash!pnet01!jca@nosc.mil | Microsoft did right. ** INTERNET: jca@pnet01.cts.com ** UUCP : {nosc ucsd hplabs!hd-sdd}!crash!pnet01!jca **--------------------------------------------------------------------------* */
perand@admin.kth.se (Per Andersson) (05/03/90)
In article <2496@crash.cts.com> jca@pnet01.cts.com (John C. Archambeau) writes: > >Maybe I'd better refine the question, what's the difference between ordinary >swapping and demand paging? I've heard of systems having both and the demand >pager kicking in when the swapper is heavily loaded. Or am I listening to >misinformation? Swapping is when you move whole processes in and out of memory, paging when you move parts (pages). This is my favourite bashing of System V contra BSD. System V up to and including 3.2 doesn't have paging ! The most recent trouble I had with this was when installing the brand new 386/ix on my machine. I found some nice things not in the kernel, and added support for them, but no, there was to little memory to run them. Then I tried to build a new kernel, like the original one - bang. The linker process was to big to fit in memory at the same time as the OS, so it wouldn't build. Yawn..... Of course I could have read the manual but... Now does anybody really know if Xenix/386 can do paging ? Per -- --- Per Andersson Royal Institute of Technology, Stockholm, Sweden perand@admin.kth.se, @nada.kth.se
guy@auspex.auspex.com (Guy Harris) (05/04/90)
>Swapping is when you move whole processes in and out of memory, paging when >you move parts (pages). This is my favourite bashing of System V contra BSD. >System V up to and including 3.2 doesn't have paging ! What on earth are you talking about? S5 has paged since S5R3 - or S5R2 Version 2 for the VAX, perhaps some other S5R2 version for 3B2s, etc..
jackv@turnkey.TCC.COM (Jack F. Vogel) (05/04/90)
In article <2496@crash.cts.com> jca@pnet01.cts.com (John C. Archambeau) writes: >Maybe I'd better refine the question, what's the difference between ordinary >swapping and demand paging? I've heard of systems having both and the demand >pager kicking in when the swapper is heavily loaded. Or am I listening to >misinformation? Yes, you are listening to misinformation. There is no such thing as the "demand pager". Demand paging means that a process only gets pages of its process as it references them, when it references a page the first time it gets a page fault and the page is brought in. Whether it keeps the page depends on how frequently it references it. The kernel process known as the "pager" or usually seen as "vhand" when you do a ps on V3.2 is really what one should call the page stealer. It wakes up every so many system ticks and checks process pages and if they have not been referenced recently it "steals" them returning them to the free list for other processes to use. "Swapping" happens only when the pager is not able to free enough pages to satisfy the need of the scheduler to bring in some process into core to run. When the pager cannot free enough pages via its normal stealing operation it will choose some process and "swap" it, that is takes it out of core altogether and put its image on the swap device. It is always desireable to not swap, you will not do so as long as the scheduler can keep the context of all runnable processes in core. Hope this sheds some light. Disclaimer: These are my views, not necessarily my employer's. -- Jack F. Vogel jackv@locus.com AIX370 Technical Support - or - Locus Computing Corp. jackv@turnkey.TCC.COM
glenn@extro.ucc.su.OZ.AU (Glenn Geers) (05/04/90)
From article <2496@crash.cts.com>, by jca@pnet01.cts.com (John C. Archambeau): > > Maybe I'd better refine the question, what's the difference between ordinary > swapping and demand paging? I've heard of systems having both and the demand > pager kicking in when the swapper is heavily loaded. Or am I listening to > misinformation? The swapper kicks in when the pager can't handle the load. The fundamental difference between a purely swapped system (e.g. U*IX on a 286) and a demand paged system is that the entire text and/or data does not need to be resident in core in the demand paged case. On the 386 the page size is 4k so you could conceivably run your machine with 8k of user memory available but you'd really pay for it by having a slooooooooooooooooow system since every data or text reference more than ~4k away would require a page fetch from disk. The proof that xenix pages is purely empirical - take nethack (nice and large), when you get the initial map of the first level the movement code is not in core (at least on my machine !) so when I hit a movement key the OS demand pages in the relevant bits of code (yep, the disk light goes on and there is a slight delay). For more coherent info read an OS book - a good one is "Operating Systems: Design and Implementation" by Andrew S. Tannenbaum. This is the book that gave rise to comp.os.minix. Hope this helps - but you should keep in mind that I'm a physicist not a computer scientist ! Cheers, Glenn
glenn@extro.ucc.su.OZ.AU (Glenn Geers) (05/04/90)
From article <1990May2.220056.25855@kth.se>, by perand@admin.kth.se (Per Andersson): > > Swapping is when you move whole processes in and out of memory, paging when > you move parts (pages). This is my favourite bashing of System V contra BSD. > System V up to and including 3.2 doesn't have paging ! The most recent trouble > I had with this was when installing the brand new 386/ix on my machine. > I found some nice things not in the kernel, and added support for them, but no, > there was to little memory to run them. Then I tried to build a new kernel, > like the original one - bang. The linker process was to big to fit in memory > at the same time as the OS, so it wouldn't build. Yawn..... Of course I could > have read the manual but... > Now does anybody really know if Xenix/386 can do paging ? As far as I can tell it *really* does demand page. Take a program that accesses more than phys. mem - kernel mem (A simple array clear/fill program is good here) and run it twice. On my machine both processes complete albeit slowly and vmstat -s shows pagein/pageout to the swap area go up nicely. I have also had gcc blow out to over 4 Mb of data (all that shows up on ps) without complaint. Glenn
jca@pnet01.cts.com (John C. Archambeau) (05/04/90)
perand@admin.kth.se (Per Andersson) writes: >In article <2496@crash.cts.com> jca@pnet01.cts.com (John C. Archambeau) writes: >> >>Maybe I'd better refine the question, what's the difference between ordinary >>swapping and demand paging? I've heard of systems having both and the demand >>pager kicking in when the swapper is heavily loaded. Or am I listening to >>misinformation? > >Swapping is when you move whole processes in and out of memory, paging when >you move parts (pages). This is my favourite bashing of System V contra BSD. >System V up to and including 3.2 doesn't have paging ! The most recent trouble >I had with this was when installing the brand new 386/ix on my machine. >I found some nice things not in the kernel, and added support for them, but no, >there was to little memory to run them. Then I tried to build a new kernel, >like the original one - bang. The linker process was to big to fit in memory >at the same time as the OS, so it wouldn't build. Yawn..... Of course I could >have read the manual but... >Now does anybody really know if Xenix/386 can do paging ? Thanks for that explanation. And as for whether or not Xenix 386 does paging. I'm sure it does. I went into /usr/sys/conf and ran ./configure (as root) and did some kernel tweaking. It would indicate that you can tell it how much you can page in and out for processes. Apparently (I did not tweak any parameters dealing with virtual memory, swapping, or paging) you can make processes larger than physical memory. So if that's the case, it has to support paging. // JCA /* **--------------------------------------------------------------------------* ** Flames : /dev/null | Xenix is the ONLY thing ** ARPANET : crash!pnet01!jca@nosc.mil | Microsoft did right. ** INTERNET: jca@pnet01.cts.com ** UUCP : {nosc ucsd hplabs!hd-sdd}!crash!pnet01!jca **--------------------------------------------------------------------------* */