Click here to Skip to main content
15,892,674 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: State Machines - my brain won't do what I want it to Pin
F-ES Sitecore14-May-20 0:31
professionalF-ES Sitecore14-May-20 0:31 
GeneralRe: State Machines - my brain won't do what I want it to Pin
Sander Rossel14-May-20 0:52
professionalSander Rossel14-May-20 0:52 
GeneralRe: State Machines - my brain won't do what I want it to Pin
F-ES Sitecore14-May-20 5:39
professionalF-ES Sitecore14-May-20 5:39 
GeneralRe: State Machines - my brain won't do what I want it to Pin
Tim Deveaux14-May-20 1:14
Tim Deveaux14-May-20 1:14 
GeneralRe: State Machines - my brain won't do what I want it to Pin
Rich Leyshon14-May-20 1:40
Rich Leyshon14-May-20 1:40 
GeneralRe: State Machines - my brain won't do what I want it to Pin
Tim Deveaux14-May-20 1:57
Tim Deveaux14-May-20 1:57 
QuestionRe: State Machines - my brain won't do what I want it to Pin
kmoorevs14-May-20 4:28
kmoorevs14-May-20 4:28 
AnswerRe: State Machines - my brain won't do what I want it to Pin
kalberts14-May-20 9:58
kalberts14-May-20 9:58 
That obviously depends on the software.

Many years ago, I was working on a timesharing minimachine (16 bits CPU, half a megabyte of RAM) serving 20 simultanous users, so the CPU was quite heavily loaded. Even a moderate size student program took minutes to compile.

Some guys (students, of course) discovered that when you hit a key on the keyboard, the OS would raise the priority of that user process for a brief period. This was to give good interactive response. If the process was still in the running state after a couple of seconds, it was probably doing some lengthy processing, such as a compilation, and given lower priority that those processes in an active user dialog.

What these students discovered: Priority was raised on keyboard interrups even when the process was not waiting for keyboard input. If they had a lengthy compilation, they could rest a finger on the space bar for a continous stream of keyboard interrupt, so that their compilation was done at "interactive" priority, pushing the jobs of the 19 other users aside, in effect taking all of the capacity of the CPU. This worked as long as you were the only one knowing this trick. Of course it leaked out, and soon all 20 users ran their compilations competing for the CPU at interactive priority, no different from when they had been competing a "background" priority earlier. But if there were one user actually trying to get some interactive work done, it was almost impossible, with heavy compilations running at the same high priority.

We reported this problem to the vendor, and in the next release of the OS, the priority was raised only if the process was actually waiting for keyboard input, not when it was busy compiling.

The students frequently commented that the OS textbook was wrong: It stated that timesharing makes it appear as if you have the entire machine to yourself (that was a common claim in OS textbook of that age). The students argued that truth is exactly the opposite: It makes you realize that you do not have the machine to yourself! The situation with you as the only one trying to edit a source file with 19 compile jobs artificially raised to the same priority is an extreme example of that.

For the elevator: Pressing again will certainly not speed up the motors pulling the carriage. If it were to have any effect, it would be because the control logic said something like: "Sure, I was on my way up to pick up that person on floor 12, but those guys down at floor 2 are nagging me so much that I'll turn around and leave that 12th floor guy to himself for a while and rather take care of those naggers".

I have never seen, or hear of, any elevator with such a behaviour. There are reasons why textbooks call one disk scheduling method the "elevator algorithm": Your arm movement (or elevator carriage) sticks to the same direction of movement as before, processing any request to the positions it passes by, until there are no more requests in that direction. Then it turns around and processes all the request up to the opposite outermost requested position. The disk arm (or elevator carriage) swings back and forth like a pendlum, serving any request to the positions it passes (those are request that arrived since last time this position was passed).

A difference from the pendlum is that the disk arm / elevator carriage does not necessarily go to the very end of their range. If there are no requests beyond floor 12, the elevator turns around there. If, a split second after the elevator has turned around, someone at floor 14 pushes the button, they will have to wait until the carriage has gone all the way to the bottom and returning back up, serving requests both on the way down and the way up. No elevator will on its way from floor 12 to 11 stop and say "We better return to pick up this 14th floor guy before we go down".

The only cases where I have experienced an elevator on the way to my destination floor stopping to go the other way is when some elevator serviceman uses his special override key to force the carriage to a specific floor. That sets the entire elevator algorithm aside, forcing one single destination floor, dropping all other requests. That is an exceptional situation. In normal operation, an elevator runs the elevator algorithm, which will not be disabled by repeated keypresses.
GeneralRe: State Machines - my brain won't do what I want it to Pin
Mircea Neacsu14-May-20 3:05
Mircea Neacsu14-May-20 3:05 
GeneralRe: State Machines - my brain won't do what I want it to Pin
F-ES Sitecore14-May-20 5:39
professionalF-ES Sitecore14-May-20 5:39 
GeneralRe: State Machines - my brain won't do what I want it to Pin
Tim Deveaux14-May-20 6:36
Tim Deveaux14-May-20 6:36 
GeneralRe: State Machines - my brain won't do what I want it to Pin
Dar Brett14-May-20 2:13
Dar Brett14-May-20 2:13 
GeneralRe: State Machines - my brain won't do what I want it to Pin
Matthew Dennis14-May-20 2:48
sysadminMatthew Dennis14-May-20 2:48 
GeneralRe: State Machines - my brain won't do what I want it to Pin
Marc Clifton14-May-20 3:52
mvaMarc Clifton14-May-20 3:52 
GeneralRe: State Machines - my brain won't do what I want it to Pin
Member 1298255814-May-20 8:45
Member 1298255814-May-20 8:45 
RantWindows Update. Are you KIDDING me? PinPopular
Chris Maunder13-May-20 14:09
cofounderChris Maunder13-May-20 14:09 
GeneralRe: Windows Update. Are you KIDDING me? Pin
Richard Andrew x6413-May-20 14:22
professionalRichard Andrew x6413-May-20 14:22 
GeneralRe: Windows Update. Are you KIDDING me? Pin
PIEBALDconsult13-May-20 14:34
mvePIEBALDconsult13-May-20 14:34 
GeneralRe: Windows Update. Are you KIDDING me? Pin
Richard Andrew x6413-May-20 14:40
professionalRichard Andrew x6413-May-20 14:40 
GeneralRe: Windows Update. Are you KIDDING me? Pin
Greg Utas13-May-20 14:41
professionalGreg Utas13-May-20 14:41 
JokeRe: Windows Update. Are you KIDDING me? Pin
Richard Andrew x6413-May-20 14:45
professionalRichard Andrew x6413-May-20 14:45 
GeneralRe: Windows Update. Are you KIDDING me? Pin
Greg Utas13-May-20 15:09
professionalGreg Utas13-May-20 15:09 
GeneralRe: Windows Update. Are you KIDDING me? Pin
Gary R. Wheeler13-May-20 15:26
Gary R. Wheeler13-May-20 15:26 
GeneralRe: Windows Update. Are you KIDDING me? Pin
Richard Deeming14-May-20 0:39
mveRichard Deeming14-May-20 0:39 
GeneralRe: Windows Update. Are you KIDDING me? Pin
Dan Neely14-May-20 2:35
Dan Neely14-May-20 2:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.