Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Segmentation (was Re: ARRGH (Strings and things)) Message-ID: <8877@hoptoad.uucp> Date: 1 Nov 89 18:05:14 GMT References: <14386@well.UUCP> <2825@hub.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 37 In article <2825@hub.UUCP> 6600pete@hub.UUCP writes: >This would be a good article for Macker. How to use UnloadSeg safely. It would >cover > o when to do it > o what to do in the rest of the code to make sure you don't access > any globals accessed while their segment is swapped out Oh boy. The problem with MacTutor is now and always has been that the staff lack technical expertise, yet try to run a technical magazine. It would be great if your zine could cover that gap. But this question is (I don't know how to phrase this tactfully) silly. Globals and segmentation have absolutely nothing to do with each other. Globals don't live in a segment, they live in a single block of storage allocated by the OS when the application is launched. Nothing personal or inflammatory is intended, but if you are going to make this kind of extremely basic error, what makes you any more qualified than Dave Smith to run such a magazine? > o how to make sure there will always be space to load a swapped-out > segment. This is a bit more perceptive. Answer is: you have to make sure there is always a contiguous chunk of storage which is free and which is as large as the combination of the largest unloadable segments which may need to be simultaneously loaded. If this sounds difficult to compute, it's because it is; it would be easy to overlook a possible combination of segments which could occur at some point in execution. Nor would testing do much good, since all the tester could tell you would be "It just quit all of a sudden while I was doing X!" Doing X is likely to take you here, there, and everywhere in the code. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Something was badly amiss with the spiritual life of the planet, thought Gibreel Farishta. Too many demons inside people claiming to believe in God." -- Salman Rushdie, THE SATANIC VERSES