Live data from Hacker News

Computer Science from the Bottom Up

bottomupcs.com

51–60 of 104 posts

Re: Computer Science from the Bottom Up

#51
post #17

The ELF binary format, really? This is like a course advertising itself as an introduction to normative ethics and proceeding to lecture people on canon law in the 14th century in Flanders. Like sure if you into obscure shit this might be interesting but dunno what one has to do with the other.

Not sure what's obscure about ELF. Almost every one of the programs I use is wrapped in ELF format, except for maybe a bootloader and scripts.

If you want to learn from bottom up, then learning what programs are seems like an obvious approach.

Re: Computer Science from the Bottom Up

#52

I think these CS books should start with a philosophical look at what kind of thing computation actually is, rather than diving straight into UNIX file system structures with barely any context. But I guess that would be computer science from the top down.

Yeah, the first page of this book being "Everything is a File in Unix" is already so high-level and far above what I would call the "bottom-up" of computer science that this book should be renamed "Unix from the bottom-up."

The "bottom" of computer science would be mathematically explaining what it means to compute, and building up to the abstraction of a Turing machine, and eventually getting to a concrete implementation of what we call programming and code. This book has code on page 2 - but code is nowhere near the bottom.

Re: Computer Science from the Bottom Up

#53
post #46

Earlier quoted context omitted.

Depends on what do you mean by window. If the window lives in a X server and you clone the client, window will obviously not get duplicated. It's quite clearly defined what gets duplicated and what gets shared on clone()/fork(). There really is no ambiguity.

I'm not saying a particular implementation is ambiguous as to what it does . Obviously any implementation will do something . I'm saying that fork as a concept is ambiguous as to what it should do.

You're forking a process, not the whole system. Sorry, but I fail to see the ambiguity. If the window is in the process as some framebuffer, it gets cloned too. That may not mean you'll get two windows on your monitor, because your display engine is HW thing, and not a process.

Re: Computer Science from the Bottom Up

#54
As much as I appreciate such material, but this is not "computer science". Maybe "computer engineering", or some mix of "software engineering", "systems engineering", those things.

Computer science is about algorithms, complexity, possibly foundations of programming languages, cryptography, database theory, those things. Not about Unix or file formats.

Those are important too, but not "computer science".

Re: Computer Science from the Bottom Up

#55
post #46

Earlier quoted context omitted.

Depends on what do you mean by window. If the window lives in a X server and you clone the client, window will obviously not get duplicated. It's quite clearly defined what gets duplicated and what gets shared on clone()/fork(). There really is no ambiguity.

So, do threads get duplicated or shared? Or something altogether different happens to them?

That's documented in man 2 fork.

Re: Computer Science from the Bottom Up

#56
post #53

Earlier quoted context omitted.

I'm not saying a particular implementation is ambiguous as to what it does . Obviously any implementation will do something . I'm saying that fork as a concept is ambiguous as to what it should do.

You're forking a process, not the whole system. Sorry, but I fail to see the ambiguity. If the window is in the process as some framebuffer, it gets cloned too. That may not mean you'll get two windows on your monitor, because your display engine is HW thing, and not a process.

It's because you're thinking "it does X! it's not ambiguous!" but still missing that the question is over why it SHOULD do X instead of Y, not over whether it does X or Y. To a user, it sure as heck doesn't make sense to fork a process and still end up with one window for both of them. For lots of processes the process is its windows as far as the user is concerned.

Re: Computer Science from the Bottom Up

#57
post #49

Earlier quoted context omitted.

We were talking about the presentation of "fundamentals" in the courses on Computer Science, right? The fork/exec design is highly non-trivial and so should probably deserve more discussion, with examples of alternative designs and design considerations, than mere "that's how new processes are created, nothing special here, let's move on".

If you want to look at it as ‘fundamentals’, fork only requires the concept of a task, whereas your top-level comment's suggestion also requires (a) secondary storage, (b) organized into files, (c) that can be named. (That's not why Unix developed with fork, though.)

The (b) and (c) are not really needed: early timesharing systems managed to launch processes straight from the punched card decks IIRC. And without (a), what do you even need the second, identical task for? I guess it could be used parallelize crunching the numbers, but that's it; and probably that should perhaps be done from the system operator layer anyway? Like, "launch 5 copies of program on this deck but mark one specific slot in memory different for them, so they would know their ID".

Re: Computer Science from the Bottom Up

#58

I can't be the only one, but I feel pretty sure I'm in a minority among computer programmers. This "bottom-up" approach is just not the way my brain works. I definitely feel I'm a top-down sort of thinker and learner, and this puts me at a disadvantage, regarding the literature and approach in this profession. Are the terms describing the two approaches here "empirical" versus "rational"? I'm talking about building b…

I think it would be good to re-package this information, but for me, the critical thing that stuff like this accomplishes is comprehensiveness. You have to go through so many classes at school just to have all the knowledge base covered at all. Everything is compartmentalized by default, so that's kind of the mother of all bottom-up approaches.

Top-down takes time and reflection, and re-packaging.

Re: Computer Science from the Bottom Up

#59

Slightly off-topic, but... am I the only one who is troubled by the fact that the explanations of "fork and exec" are almost never, ever, discuss the rationale for picking this design instead of "CreateProcess()" a.k.a. "just_launch_this_exe_file()", or even acknowledge this alternative design? A student would probably expect that to launch an app, there is a system call that would do exactly that: you pass it the na…

From "Operating Systems: Three Easy Pieces" chapter on "Process API" (section 5.4 "Why? Motivating The API") [1]:

    ... the separation of fork() and exec() is essential in building a UNIX shell,
    because it lets the shell run code after the call to fork() but before the call
    to exec(); this code can alter the environment of the about-to-be-run program,
    and thus enables a variety of interesting features to be readily built.

    ...

    The separation of fork() and exec() allows the shell to do a whole bunch of
    useful things rather easily. For example:

      prompt> wc p3.c > newfile.txt
    
    In the example above, the output of the program wc is redirected into the output
    file newfile.txt (the greater-than sign is how said redirection is indicated).
    The way the shell accomplishes this task is quite simple: when the child is
    created, before calling exec(), the shell closes standard output and opens the
    file newfile.txt. By doing so, any output from the soon-to-be-running program wc
    are sent to the file instead of the screen.
[1] https://pages.cs.wisc.edu/~remzi/OSTEP/cpu-api.pdf

Re: Computer Science from the Bottom Up

#60
I'm disappointed this didn't start from "sand", quantum mechanics, silicon doping, electromagnetism, electronics, transistors, gates and latches, etc.

Also, Computer Science is a much broader field than what this website addresses including very little science but actually a mixture of math (e.g. P vs NP stuff) and engineering (both hardware and software), this website addressing a subset of the engineering part.

Post reply on HN