Multiple threads?
|
08-07-2017, 12:25 AM
Post: #1
|
|||
|
|||
Multiple threads?
I often like to test various algorithm inventions of mine on my calculator, and one thing I'd like to simulate is multiple threads. e.g. I have a new encryption algorithm, but the complex part of it is the interaction between 2 devices. Simulating this involves running 2 programs at the same time, interacting with one another. I guess I could emulate it by running one function as the "transmit" device and any data sent is stored in a variable. Then I can call another function as a "receive" device, effectively implementing multiple threads by sequentially calling functions to simulate each step in a round robin configuration. I was just wondering if anyone has played around with this kind of functionality, implementing some kind of multiple threading on the Prime. Also if the HP guys on this forum could tell me, does the prime run multiple threading under the hood (like an RTOS or something)?????
Thanks in advance. -Donald |
|||
08-07-2017, 03:23 AM
Post: #2
|
|||
|
|||
RE: Multiple threads?
I think you can do this as long as you do not try to handle INPUT, CHOOSE, MSGBOX, EDITLIST, EDITMAT and WAIT (-1) in parallel.
Viga C | TD | FB |
|||
08-07-2017, 05:37 AM
Post: #3
|
|||
|
|||
RE: Multiple threads?
Hello,
Although the underlying OS is multithread, the PPL system is not designed for it. Specifically, the PPL system accesses global/shared variables, and access to these shared resources are not thread safe. More than anything, this is what is blocking PPL from being multi threaded. The second issue is that correct multithreaded programming is hard. A lot of SW engineers that I know make mistake creating such programs. said mistake resulting in crashes of their program. A programming system that lets programmer create programs that have this type of errors might be OK when destined to professionals, however, it is not when designed to be used by "normal people" (as is PPL). So, in your case, I am sorry, but you most likely will have to implement some type of "transmit" function as you described above. Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. |
|||
08-07-2017, 09:30 AM
Post: #4
|
|||
|
|||
RE: Multiple threads?
I can do it round robin using functions in a loop.
Thx |
|||
08-08-2017, 12:33 AM
Post: #5
|
|||
|
|||
RE: Multiple threads?
I have not used the HP Prime specifically, and my last serious RPL was several years ago --- I've pretty much returned to FOCAL for the little programming I do. But it occurs to me that you might be able to simulate threads with some sort of continuation passing or callbacks. It's similar to how we simulated threads on hardware like the Newton MessagePad and Palm Pilot back in the day, and the callback paradigm is still used today in things like Node.js,
I may be totally off base, though. I keep meaning to play with the Prime emulator to see what I'm missing. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)