|
Author |
Topic: multithreading (Read 3033 times) |
|
Martin
|
multithreading
« on: Feb 10th, 2003, 8:55pm » |
|
Multithreading Example Multithreading makes running several processes at the same time possible. Being able to do this, a visual element does not have to wait for another to finish its course. Thus, this concept would open avenues to dynamic form in parallel composition. http://studio.instituteofmedia.com/experiments/multithread/
|
|
|
|
Glen Murphy
|
Re: multithreading
« Reply #1 on: Feb 11th, 2003, 4:14am » |
|
Handy code to have. Cheers!
|
|
|
|
REAS
|
Re: multithreading
« Reply #2 on: Feb 12th, 2003, 10:09pm » |
|
Martin, Could you please elaborate on the ramifications of your threading code... + Casey
|
|
|
|
Martin
|
Re: multithreading
« Reply #3 on: Feb 13th, 2003, 8:07am » |
|
hi casey, big word (ramifications) ... what do you mean? i mean, what do you mean specifically? (put comments on the code? and/or, further explain the description? ... ) cheers! best, martin
|
|
|
|
REAS
|
Re: multithreading
« Reply #4 on: Feb 13th, 2003, 11:45am » |
|
what's it good for?
|
|
|
|
Martin
|
Re: multithreading
« Reply #5 on: Feb 13th, 2003, 6:59pm » |
|
short answer: a whole lot of things. specifically the example code provided are the ff: - able to do an infinite loop even if draw() is used, without using loop() ... and show the output in realtime. - draw something once while draw other elements in a loop of sorts - show how multithreading can be done in proce55ing - show what multithreading is (quite blurry i must admit) and how things can run in "parallel" - good for posting in the 'learning' section of this site (or, maybe i should come up with something nicer) long answer to follow. look to this weekend.
|
« Last Edit: Feb 13th, 2003, 7:03pm by Martin » |
|
|
|
|
martin_publicterm Guest
|
Re: multithreading
« Reply #6 on: Feb 14th, 2003, 4:04am » |
|
wondering, do the images show up on your computers? i'm using a public terminal right now and it's either they don't show or the connection is really bad. however, when i load it at home, they show up good.
|
|
|
|
martin_publicterm Guest
|
Re: multithreading
« Reply #7 on: Feb 14th, 2003, 4:15am » |
|
ah... it's with the java vm. hhmm... i installed jdk1.4.0 on this terminal and it's now loading fine. tsk...
|
|
|
|
Martin
|
Re: multithreading
« Reply #8 on: Feb 17th, 2003, 4:41pm » |
|
on Feb 13th, 2003, 6:59pm, Martin wrote:long answer to follow. look to this weekend. |
| there will be a slight delay. been stuck with work in the real world. thank you for your patience.
|
|
|
|
Martin
|
Re: multithreading
« Reply #9 on: Feb 23rd, 2003, 1:58pm » |
|
One of the good things about multithreading is if you want to speak and listen at the same time, it offers you that possibility. I've posted an elaboration at http://proce55ing.net/discourse/yabb/board_Tools_action_display__num_1046005023.html I don't know if it should fall under "Tools" or "Beyond Categories"... I just placed it here.
|
« Last Edit: Feb 23rd, 2003, 2:00pm by Martin » |
|
|
|
|
mflux
|
Re: multithreading
« Reply #10 on: Oct 29th, 2003, 12:16pm » |
|
I'm sorry but can you elaborate more on this? Some questions: -Just how is it running without loop()? -The concept of things running in parallel is alien to me, please explain how... -How do they know when to update themselves? What causes this? -I'm also having trouble reading how your code exactly works... It seems to me, the computer only runs code one line at a time. In order to simulate real-time dynamic things you still need to go through a list and update/redraw each of them one by one. What benefits do you get by not doing so? Is it faster? The only advantage I can see for this is for better cellular automata where the order in which cells are simulated really matter. Does this negate that shortcoming?
|
|
|
|
benelek
|
Re: multithreading
« Reply #11 on: Oct 30th, 2003, 4:09pm » |
|
in a basic sense, loop() as you'd have been using it is an example of a single thread. most of the curtom threading stuff which you see in Martin's example is done by p5 or by java itself behind the scenes. the way a thread accomplishes the loop or does an update, is by setting a delay() after which it restarts its infinite loop (occuring within the run() method of a thread class). this might take the following form: Code:while(true) { //do something. rect(5,5,10,10); //wait 10ms before repeating. delay(10); } |
| technically, things do not run in parallel on computers. it's easier to think of it as two pieces of software running at the same time: they do not need to wait for each other to complete tasks, they can run tasks at different speeds, and are essentially independant of each other. but deep down in the techie world of specifics, no particular action of the computer is done precisely at the same time as something else. this is what leads to performance increases - not having to wait for overall processes to be finished before moving onto others, and being able to work when something else has to wait. For instance, when you set the framerate of your applet using framrate(), you're telling p5 to pause for a certain period of time in between each run of loop(). if you're running something else in "parallel", it can be working during that pause period.
|
|
|
|
arkadyan
|
Re: multithreading
« Reply #12 on: Apr 15th, 2004, 4:49am » |
|
martin, the instituteofmedia domain seems to have expired, so it's no longer possible to see examples there. It sounds like there are some very useful things that were there - it would be nice to see them continue to exist somewhere. cheers matt
|
|
|
|
fphunct
|
Re: multithreading
« Reply #13 on: Apr 20th, 2004, 6:06pm » |
|
I have used multithreading in P5 to play two audio files at the same time. Currently, I'm not a aware of how this could be implemented with a singlethreaded application because the code generally looks like this: ** play(audio1); play(audio2); ** Unless you have an EXTREMELY fast machine, those two sounds won't play at the same time because it plays audio1 before audio2. With multithreading, you could have one thread handling audio1 and another thread running audio2. This way, audio1 is executing at the same time as audio2. An example of an implementation of multithreading could be found in the following link: http://tyrannasaur.us/experiments/beastbox/
|
|
|
|
|