Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!uunet!tnc!m0154 From: m0154@tnc.UUCP (GUY GARNETT) Newsgroups: comp.sys.amiga.misc Subject: Re: True Multitasking Message-ID: <678@tnc.UUCP> Date: 24 Jan 91 16:23:14 GMT References: <42149@nigel.ee.udel.edu> <672@tnc.UUCP> <42598@nigel.ee.udel.edu> Reply-To: m0154@tnc.UUCP (GUY GARNETT) Organization: The Next Challenge, Fairfax, Va. Lines: 95 In article <42598@nigel.ee.udel.edu> new@ee.udel.edu (Darren New) writes: >In article <672@tnc.UUCP> m0154@tnc.UUCP (GUY GARNETT) writes: >>As I understand it, the Amiga does not have "threads" or "lightweight >>processes". The Amiga does make a distinction between "processes" and >>"tasks". A process could be described as a task that is known to >>AmigaDOS (Amiga EXEC handles multitasking, at a level below AmigaDOS). > >Not really. AmigaDOS does indeed have lightweight processes, which >are called "tasks". An AmigaDOS "process" is a task with an easily- >locatable communication buffer for use by certain system libraries >(primarily the file system). However, tasks can and do perform I/O >via message passing. The filesystems simply require that the I/O >be done to a certain location. > Tasks are not lightweight Processes; tasks and processes are the same to Exec. The distinction is at the AmigaDOS level; as I said in my first message. Tasks and Processes can both do I/O through DOS; processes have the necessary DOS structures built-in, tasks must do some setting-up first. Tasks and Processes can both use the file system; processes simply have it pre-defined for them (I never said differently, please read my original message). > >>Processes have a current directory, standard input and output streams, >>and some other things which tasks do not. > >Yes. AmigaDOS "processes" are supersets of tasks, but the differences >have nothing to do with addressing or scheduling. > Right. That's what I said. From the point of view of the threads vs no-threads debate, Amiga tasks and processes are the same. They are, of course, not the same to AmigaDOS. > >>Although all of the tasks and processes on the Amiga share an address >>space, it is not intended that there be multiple execution traces >>through the same code and data (with the well-defined exception of >>certian operating system code). > >There can be. What do you mean by "the same code"? The same executable >image in memory? Happens all the time (with "resident" programs), i.e., >shared-code in UNIX-speak. Many programs (esp games and telecom programs) >have multiple tasks using the same non-shared executable. > >>You *CAN* do it, but you do not get >>the same benefits that threads get - the operating system overhead is >>the same, and writing code to work this way adds its own overhead. > Yes, I am talking about the same image in memory. The well defined exception I am talking about is when pure code is made resident. This is usually used for system level code, cli commands, and the like; I don't think it is indended that applications programs be made resident (can you imagine re-coding wordperfect so that it is pure, and then making it resident? Yes, it could be done, but it soulds like a lot of work for little benefit; better to modify it so that it can handle more documents at once without bogging down). Multiple programs using the same executable, loaded at different locations in memory (one for each invocation of the program) is a different beastie; most Amiga software should be coded so that this is possible. > >It is exactly the same as threads. Tell me what a thread gives you >that an AmigaDOS task does not? Or vica versa. -- Darren > >-- >--- Darren New --- Grad Student --- CIS --- Univ. of Delaware --- >----- Network Protocols, Graphics, Programming Languages, > Formal Description Techniques (esp. Estelle), Coffee, Amigas ----- > =+=+=+ Let GROPE be an N-tuple where ... +=+=+= The distinction made in other operating systems (OS/2 and a few others) is that multiple threads execute as one task, and the operating system manages multiple tasks. The task switch on these operating systems is quite involved and time-consuming; and every task has a separate address space. Threads within a task share the same address space (that of the task), and switching between threads within a task is relatively fast and efficient. While the amiga does not have threads, Exec has some of the features that threads are supposed to bring to other operating systems (specifically, lower operating system overhead and faster task switches for better real-time response). Because of the design of the Amiga hardware, the amiaga also has all of its tasks sharing the same address space; but amiga programs are not supposed to reference memory that they have not received control of (through memory allocation or message passing). In short, threads are implemented in other operating systems to improve the efficency of the OS with regard to handling multiple, closely-coupled tasks, all of which are working on parts of the same problem. The Amiga does not have threads, and doesen't need them, because its multitasking and message passing systems are already highly efficient. What other operating systems need a special facility for is simple one more application of the Amiga's multitasking operating system. And it has been for years. Wildstar