Hacker Newsnew | past | comments | ask | show | jobs | submit | dingu's commentslogin

It's visually a nice collection. As a documentary it is pretty inaccurate in a number of key areas. The BBS Documentary has a very nice and accurate treatment (interviews with actual people from the scene) if one is interested.


You are confused. File descriptors on linux represent "many different types." They are not just for "disk files". Please see signalfd, timerfd, eventfd, inotify, let alone sockets (which themselves represent things other than IP sockets). FD is essentially like handle. epoll therefore works with many different types.


While the Unix philosophy is that everything is a file - that is not the case with Linux. Futexs being a good example. There was an attempt to integrate them but it was done incorrectly with inherent race conditions and abandoned.

The VMS and NT philosophies of everything being an object are a bit more general and easier to follow in practice.


Futexes currently have _no_ kernel state besides in the threads that are currently waiting on them. There's no futex_create system call for instance. It's litreally just a call to "sleep until this memory address changes or a timeout occurs". There's not really anything to make a type around, which is why FUTEX_FD was doomed to failure and they rightly backed it out.


You may be surprised to learn that some windows handles are actually just addresses with no kernel state too. A great example is an HMODULE.

In fact windows actually reserves a block of user address space that will never be allocated to disambiguate memory vs non memory handles.

Its really a pitty these two great systems refuse to learn from each other.


Ah you edited your response? An HMODULE.. That is weak dude. Calling and HMODULE a HANDLE is cheating... by that definition a UINT is a HANDLE since you can cast it.

Can you use HMODULEs orthogonally to common APIs that use Handles? That's what really matters. Just because something is 4 or 8 bytes wide and you call it the same thing isn't interesting. Like can you pass HMODULE to WaitForSingleObject? Oh Ok, I guess that's mean because to be fair, what does "waiting" on a DLL mean.

Ok, well surely you can pass that HMODULE to CloseHandle, at least closing should be orthogonal.. Why don't you try that? I'll wait.

So what point are you trying to make here? It sound like you're just jerking everyone around, tbh.

Edit: Moreover, it's a bit ridiculous to say that an HMODULE is just an address with no kernel state. It uniquely identifies the loaded DLL, so it a key to a tremendous amount of kernel bookkeeping about the loaded module.


The handle is a _kernel_ address... backed by a validly constructed kernel object.

EDIT: And since you dirty edited, can you point to an example of HMODULE or any other dataless HANDLE being used on the syscall interface?


Handles are not kernel addresses in NT and windows will not intentionally leak those to user space. Handle accesses are always through a layer of indirection in the object manager.

You will find that windows never makes guarantees of what handles actually are - in case it wants to change them.

In windows NT most GDI handles are user mode and not kernel objects. Other objects may or may not be kernel based depending on the version and whims of the implementor.


I mean, they're very clearly offsets into the HANDLE table kernel space.

And can you WFMO on user space only HANDLEs?


What does that have to do with anything? You wouldn't use WFMO to implement a futex in Windows. And regardless of anything in Linux, defending WFMO seems like a strange hill to die on. It's not a great API.

I'm calling your bluff too. Which one of the supported waitable handles in Windows are just addresses with no other state? I'm more surprised because they all need an access mask at a minimum, and I thought they all involve an ObCreateObject, even a Mutant... these dusty corners of the kernel are visible through the DDK. Anyway, I would be glad to be shown wrong.


I’m not sure why theres such animosity in your replies. The goal here is not to defend windows but to point out that handles need not aways refer to kernel objects.

It would be possible to provide an orthogonal handle based API even if windows doesn’t always live up to that ideal.

Ultimately it seems these systems are just too big to maintain a cohesive design - but it is still an ideal to aspire to.


Windows has WaitOnAddress() which is similar to a futex, and likewise isn't a HANDLE.

"File descriptor" is just a weird spelling of "handle", for historical reasons.


what are you on about? I just gave you the specific examples: timerfd, eventfd, signalfd, inotify... these are all epollable fds in Linux?

Futex is a special case because futexes themselves are quite special. There is no userspace equivalent to them in Windows anyway as has been mentioned. Windows Events are similar to what is provided by eventfd, but not as featureful.


Probably the core of the issue here is that VMS and derivatives tried to hard to fit everything into a generic handle/fd interface while UNIX historically came with a smaller core with many important API surfaces (like signals or timers) only relatively recently getting absorbed under the unified handle/fd interface, giving the impression it's an afterthought.

It's also not something that works on all Unices (e.g. afaik macos has no timerfd). But in all fairness, that problem only exists because OS speciation, as it's biological counterpart, is not as clear cut a concept as one would desire.


Macos timers can be waited on via kqueue FWIW.


I know; but they cannot be closed with close, or passed via unix domain sockets to other processes etc etc. I _think_ this whole thread is about "purity", whatever that means.


epoll was a problem child API on linux, with a number of missteps early on. It's much better now. It does everything WFMO does and more. What disjoint APIs are you talking about? You can just use epoll and be done with it?

What are you talking about by "wait for both"?

But jesus, the windows API in this area is hot garbage. A hard 64 limit and O(N)? It's a terrible design.


Having written a fair share of deeply embedded assembly.. if you're used to writing this close to the metal on a small system, that may have actually have been the most straight-foward way. Since ultimately the score must be rendered to the screen, and that might be its only purpose, there was probably little point in holding a "raw" intermediate value. Adding a constant and a few instructions for rollover don't sound too bad in the grand scheme of things.


figuring out tricks like that looks so fun. my "embedded" experience has been hard real time but usually on things with decent amounts of rom and ram. so tricks like that weren't needed.


People use systemd because it solves real problems that are not adequately solved by init scripts. Your "want for nothing" says more about your limited needs (which is fine) than anything else about system management services.

Regardless of one's opinions or critiques about the implementation of systemd specifically, the idea that it came up in some kind of vacuum or started a "trend" is utterly ridiculous.

Prior art in UNIX would be SMF at a minimum, and systemd clearly looked at launchd for some inspiration in other areas (systemd ended up having the goal of covering both use cases of launchd and SMF.. ie generally server and desktop).

Also what is this about binary blobs? systemd is configured with text files. Last I checked, the init process itself on BSD is a binary.


In BSD, the init(8) binary doesn't do much regarding startup - basically just executes /etc/rc; it's shell scripts all the way afterwards, nothing hardcoded.

What exactly cannot be solved with init scripts?

Also, keep in mind that FreeBSD init scripts (which actually come from NetBSD as rcng) are very different from the SysV mess Linux used to use - they handle dependencies, have a sane way of configuring way, they don't reimplement features which ceased being useful in the eighties (runlevels) etc. They are also quite fast. This means the pressure to migrate off to something else is much lower.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: