Rain 🚱 is a user on cybre.space. You can follow them or interact with them if you have an account anywhere in the fediverse.

I taught some C to my sis today and it's hard because she is smart and has questions
like, I wasn't prepared to have to explain PRNGs but I had to coz she wanted to know how random number generation is done because I mentioned that "int x;" gets a random number and she asked "so if I want a random number I should just look at some random memory location" and I couldn't in good conscience say "yeah, that is a perfectly valid way to do RNG"

@grainloom function that gets a random uint8_t by continually spawning a subprocess that attempts to dereference a random memory address. when eventually one doesn't segfault, it returns that byte. warning: random number distribution is heavily biased to 0 and also quite biased to 255

Rain 🚱 @grainloom

@jk upon reading this toot Dennis Ritchie's ghost manifested in my room, took the UNIX manual from my shelf and smashed my laptop with it

· Web · 2 · 15

@starbreaker @grainloom the implementation isn’t silly enough im afraid

@djsundog @jk @starbreaker @grainloom reimplement libc with a focus on maximizing implementation silliness

@io @grainloom @starbreaker @jk @djsundog reimplement libc by shelling out to, well, shell utilities.

did I reinvent plan9 yet?

@SoniEx2 @djsundog @jk @starbreaker @io that's almost what @Shamar 's Jehanne OS does/will do, AFAIK.
Eg. he's been throwing around ideas like "allocation should be done by writing to a file" and other stuch stuff.

@grainloom @Shamar @io @starbreaker @jk @djsundog memory should be a file.

the only syscalls should be mmap and system.

@SoniEx2 @djsundog @jk @starbreaker @io @grainloom

I suggest you to try implement an OS with such approach, just for fun.

But that's now how I design syscalls for #Jehanne.

It's core abstraction is the file (for a certain definition of #file).

All services that can be exposed as file operations, are. Process memory allocation, for example, is done with a create() of a file; current time is done with a remove() of another file.

@Shamar @grainloom @io @starbreaker @jk @djsundog strcpy(mmap("/sys/mkfile", ???), "/tmp/memory"); mmap("/tmp/memory", ???); etc

@SoniEx2 @djsundog @jk @starbreaker @io @grainloom

This looks pretty weird to me.

I don't like mmap at all.

BUT, I will not be the guy who tell you to NOT hack something.

I strongly encourage you to try to write such OS. You might fail to create anything usable, but you will learn a lot in the process anyway.

Or you might succeed, showing everyone else that it was a good idea.

And I strongly encourage you to document the whole process, whatever the outcome: it's always worth to #hack.

@Shamar @io @starbreaker @jk @djsundog

Tbh I'd first recommend @SoniEx2 that they look more into Plan 9, before trying to implement something simply for aesthetic purity.

@grainloom @SoniEx2 @djsundog @jk @starbreaker @io

Well, sure.

I'd suggest to look more into Plan 9 to anyone. 😉

But if someone propose an hack I find particularly weird (but not dangerous for anyone), my first reaction is: you should really try this! 👍

Any other reaction might discourage the hacker.

@Shamar @io @starbreaker @jk @djsundog @SoniEx2

But Jehanne is only based on , it's not Plan 9, so... you probably only reinvented Jehanne?