[comp.sys.amiga.tech] Exec questions...

cogswell@egrunix.UUCP (Dan Cogswell) (10/25/89)

Is it possible for a user program to easily and reliably schedule tasks
already in the various system lists??  I ask this because I'm about to 
attempt implementing "Monitors" (kindof a structured Semaphore) to use
with the Exec.  I could use semaphores to do this, but that's not real
clean.  Basically, I would need to block a process (or task) and put it
in one of my own condition queues.  Then, at some later time, I'd have 
to re-schedule the task into one of the Exec queues (obviously the Ready
queue).  Can this be done reliably and easily??

Thanks in advance...

cogswell@egrunix.UUCP (Dan Cogswell) (10/26/89)

In article <8278@cbmvax.UUCP> valentin@cbmvax.UUCP (Valentin Pepelea) writes:
>Use semaphores, signalSemaphores to be exact, because that is the only "clean"
>way to do it.

If this is true, how are semaphores implemented?? :-)

I was informed of a cleaner way of doing it using Wait() and Signal().  To
block a process, I do this:

	FindTask(NIL)
	AllocSignal()
	put these things into a Node 
	AddTail(mylist,mynode) 
	Wait(mask).

To wake-up a process, I do this:
	
	RemHead(mylist)
	Signal(mynode.task,mynode.signal)
	CleanThingsUp()

(Any similarities to real code purely coincidental)

>Just what will happen to your Monitors when the multiprocessing Amiga XMP 
>comes out? 

Well, if I knew what an "Amiga XMP" was, maybe I could answer that 
question!  :-)  Care to fill us in??

Actually, this is a project for a Grad operating systems class I have 
(BTW, I'm undergradute and only a junior).  I may develop it into a shared
library so all the world can benefit from my headaches. :-)

>Valentin

============================================================================
Dan Cogswell				   "Gangster Fun -- It's the beat 
(313)625-3234				      that you can wig-out to..."
INTERNET: cogswell@unix.secs.oakland.edu
UUCP:  cogswell@egrunix.UUCP
============================================================================

valentin@cbmvax.UUCP (Valentin Pepelea) (10/27/89)

In article <8278@cbmvax.UUCP> valentin@cbmvax.UUCP (Valentin Pepelea) writes:
>In article <218@egrunix.UUCP> cogswell@unix.secs.oakland.edu (Dan Cogswell)
>writes:
>
>> Is it possible for a user program to easily and reliably schedule tasks
>> already in the various system lists??  
>
>Only if they are in the TaskReady list. If they are in the Running or the Wait
>lists, then it would be really stupid to forcibly schedule them onto the CPU.

I made an error, Bryce pointed it out to me. The answer should have been NO.

>Well yes, you can always play with the Exec lists within Forbid() calls. As
>long as the code you are executing and the data you are accessing are all in
>MEMF_PUBLIC memory, you are safe.

Here is another error. You can play with task lists only within Disable()
calls, not Forbid() calls. Congratulate bryce for this one, too. 

Valentin
-- 
"An  operating  system  without        Name:    Valentin Pepelea
 virtual memory is an operating        Phone:   (215) 431-9100
 system without virtue."               Usenet:  uunet!cbmvax!valentin
                                       Bitnet:  cbmvax!valentin@uunet.uu.net
         - Ancient Inca Proverb        Claimer: these aren't Commodore thoughts