I am looking for Ben's code, and would like to implement it in an OS, so long as Ben doesn't mind.

Additionally, I think that a stack of threads would work quite well for multiple threads, so long as they were location independent. If location independance is not going to work, then is copying code to a certain place every ieteration viable?

And to solve the problem of threadsafe code, two different threads accessing the same memory could set a "lock," which would just be a byte in the thread stack, where two threads of the same lock would not be run at the same time.

Thoughts?
Feel free to use my code for whatever purposes you so desire. I haven't thought about it too much since I knocked it together, but I'm not entirely sure how your locking system would work (what would the value of the lock be?) Disabling the thread switcher by disabling interrupts seemed simple enough a solution to me.
Thanks for offering, your code looks like it has an external include file (" .include "Multithread/Multithread.asm" ") that isn't available, where could I get this code?

And the lock would just be two bytes, such as 0000h for no lock, that represent where in the memory needs to be protected. The tasker would not execute two threads with the same lock until one of them changes the lock value. For example, thread one sets its lock to 1000h when it needs to use it, and then sets it back to 0000h when its done. Therefore, when thread two sets its lock to 1000h, the tasker won't call it until thread one resets it.
Disabling inturrupts will kill every thread, which I want to avoid.
Only locking one byte at a time doesn't seem especially useful to me. Have you seen the post qarnos made on the subject?

I've uploaded everything I did on this subject here. It's completely untested, I have no idea what it's going to do (I'd be surprised if it works at all). Razz
thanks for posting the code, and one byte at a time isn't the idea, having programs use logical areas in the memory (perhaps mentioned in the docs) is more like it, and the programs would just lock on the first byte of that section.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement