Thread: Java Threads
View Single Post
  #12   Spotlight this post!  
Unread 14-03-2011, 11:54
purduephotog purduephotog is offline
Active Defense Design Engineer
AKA: Jason
FRC #3015
Team Role: Leadership
 
Join Date: Jan 2007
Rookie Year: 2004
Location: Rochester, NY
Posts: 162
purduephotog is a jewel in the roughpurduephotog is a jewel in the roughpurduephotog is a jewel in the roughpurduephotog is a jewel in the rough
Send a message via AIM to purduephotog
Re: Java Threads

Quote:
Originally Posted by Ether View Post
How did this help you understand how threads are being executed? What points were you hoping to drive home?

Calls were being done asynchronously. That meant they were not executing in a linear fashion and you could not guarantee which would execute first.

If they executed linearly and in order, you'd have either no pulse (since the first set would be overridden when the code exited the loop) or a constant pulse rate since both calls were made in sequence, one after another, with no delays other than what the scheduler created.

Which mean the scheduler was pausing the robot.main classes and running things in the background- interrupt, so to speak, the main thread transparently. The students didn't (and still don't, I think) understand the implications of this. They think it just runs and runs and runs... they never see the pauses because they aren't presented to them.

One of the biggest issues I've had in trying to teach (and even some adults) is that just because you put two lines next to each other in the code- when dealing with hardware- you never know for certain (unless you're VERY careful) that they will execute properly. So it is always best to design with that thought in mind....
__________________
http://purduephotog.deviantart.com
Portrait Photography: "I used to say Immortalized in Silver, but now I say Captured and Squeezed by Electrons".
Reply With Quote