Using preemptive multitasking
Using preemptive multitasking
As QOS supports preemptive multitasking, I tried running two jobs in parallel. So I wrote two programs which constantly update resp. the left and right ends of the screen and try to call them using EXEC. Given it's preemptive multitasking, I assume (wrongly?) that I should not do anything special to my programs.
Using QOS 1.10, the EXEC command starts the first program successfully but does not return (contrary to what the doc says). It does support the JOBS command though, so would think it supports multitasking.
Using Minerva, EXEC does return and I can launch the two programs. However, typing JOBS just prints the header and hangs. JOBS works perfectly when only one program is running but when not two are.
Are there any specific things to know about multitasking on the QL? I did use SEXEC to generate the executables I'm running in parallel.
Using QOS 1.10, the EXEC command starts the first program successfully but does not return (contrary to what the doc says). It does support the JOBS command though, so would think it supports multitasking.
Using Minerva, EXEC does return and I can launch the two programs. However, typing JOBS just prints the header and hangs. JOBS works perfectly when only one program is running but when not two are.
Are there any specific things to know about multitasking on the QL? I did use SEXEC to generate the executables I'm running in parallel.
Re: Using preemptive multitasking
This means the machine code program you had saved with SEXEC is faulty.ecdhe wrote: Wed Jun 25, 2025 3:18 pm Using QOS 1.10, the EXEC command starts the first program successfully but does not return (contrary to what the doc says).
Re: Using preemptive multitasking
Fair enough, but are there any common caveats to look for? I made sure the program does not use any RAM for its data (only using registers), and only modifies the screen (which, based on some videos I've seen, seems acceptable).
Re: Using preemptive multitasking
Hang on, I just though of something. I'll try later tonight. But thanks for confirming it should work with QOS 1.1
-
- Font of All Knowledge
- Posts: 4779
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: Using preemptive multitasking
Hi
The QL does support multitasking, but it doesn't support buried screen updates, which I mean updating a SCR or CON channel.
There are extensions to enable this called PICE,NICE which you may say, the programs running do not update the screen.
Use Minerva, as anything like JS, JM, has bugs on it and may not run programs as expected.
With regards to the SEXEC command, it needs amount of data to create the executable program correctly.
The QL does support multitasking, but it doesn't support buried screen updates, which I mean updating a SCR or CON channel.
There are extensions to enable this called PICE,NICE which you may say, the programs running do not update the screen.
Use Minerva, as anything like JS, JM, has bugs on it and may not run programs as expected.
With regards to the SEXEC command, it needs amount of data to create the executable program correctly.
Regards, Derek
Re: Using preemptive multitasking
If I understood him correctly, he means "the left and right ends of the screen," meaning that the windows don't overlap, right?
Perhaps a photo would be helpful.
Perhaps a photo would be helpful.
7000 4E75
Re: Using preemptive multitasking
Some information about writing Jobs in section 3 of this manual, including how to terminate a job properly:
https://dilwyn.theqlforum.com/docs/manuals/qltm.pdf
https://dilwyn.theqlforum.com/docs/manuals/qltm.pdf
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
Re: Using preemptive multitasking
By starting from a program which does nothing but which works and adding more code I was able to figure out what was wrong: the `trap #0` code (switch to superviser mode) doesn't mix well with the multitasking.
This works now and I have two programs running in parallel and I can change the priority of both jobs. Thank you to all those who replied!
This works now and I have two programs running in parallel and I can change the priority of both jobs. Thank you to all those who replied!
Last edited by ecdhe on Wed Jun 25, 2025 10:58 pm, edited 1 time in total.
Re: Using preemptive multitasking
TRAP #0 enters supervisor mode. You should not use it, unless you really know what you are doing. A job needs to stay in user mode for normal scheduling.
Re: Using preemptive multitasking
Yes, I understand this. I used this code to to sync with the vblank. This works fine in a single-program case, but of course not in a multitasking environment. Just like RAM conflict can happen quite easily as the 6800X doesn't support protected mode.Peter wrote: Wed Jun 25, 2025 10:48 pm TRAP #0 enters supervisor mode. You should not use it, unless you really know what you are doing. A job needs to stay in user mode for normal scheduling.