17
luguhe
7y

Last year in my first lesson of informatics:

Me: “What does return do?”
My teacher: “If you start your program, Windows will pause and run your program. If your program is coming to the end and hits the return statement, your program will stop and Windows will run again.”

wtf

(I already knew the right answer but I wanted to ask him this question.)

Comments
  • 2
    Ahhh, no way, that's terrible!

    Where is this? What University/school/college?
  • 2
    @itsnameless
    I was told it made a popup?
  • 2
    I thought that return gave you access to all fbi servers
  • 11
    Hes actually right. Older Windows (<= 98 SE) had cooperative mutlitasking, so instead of everything being controlled by a kernel, apps were releasing system resources when they were programmed to instead being forced to by system. So instead of preemptive multitasking which looks like this:
    OS: start app1
    APP1: Printing hel
    OS: now app2, you stop now app1
    APP2: devran
    OS: now app1 resume
    APP1: ...lo world
    OS: app1 finished. App2 now is your time
    APP2: ...t is awesome

    Cooperative mutlitasking was used which looks like this:
    OS: goodapp1 start
    GOOD: *running*
    OS: good app I need to run now
    GOOD: ok *good app is being baused*
    OS: lets start bad app
    BAD: Running...
    OS: Can I run now plz
    BAD: Nah m8 lmao
    OS: Can I rum now
    BAD: F*ck off
    *OS freezes*

    The only reason why we dont see this is because we are running CPUs with many GHz.

    So yes, he was right, not today but around 18 years ago.
  • 1
    @itsnameless Downgrades are fine too, since Linux Kernel was preemptive from its beginning (1991).
  • 0
    Didn't you know, return adds two numbers together!

    More seriously though, it's what @CopyPasteCode said. For Windows 3.11 and below, a program exiting would return control to the OS. (It was single threaded / no concept of threads). Thus, `return` would literally allow Windows to run again.
  • 0
    @Ashkin nope, Win 98 SE and older (basically all DOS (pre NT) based Windows) - that means W98se, 98 and 95 too
  • 1
    @CopyPasteCode I'm referencing the ones without any multitasking.

    Though I could be wrong about this. I think I was 3 when I saw Windows 3.1 last...
  • 0
  • 2
    Silly professor. Return solves P vs NP Problem. That's common knowledge...
  • 0
    @CopyPasteCode I know that he is right if he would have told this to me like 20 years ago but now we have multiple threads and multitasking is the main thing of a computer.
  • 0
    I can't even.
Add Comment