Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> probably easier than using whatever async/await interface your language has

Is it? I haven't used threads directly in a while, but I remember dealing with sinchronization issues. Problems that just don't exist in single threaded node with async await.

I find the async Promise or Task to be a more useful abstraction than the thread. Although, you need threads or a task dispatcher with a pool of threads if you need to run cpu intensive stuff.



If you’re just handling requests there isn’t much for shared state, so you don’t have to worry about synchronization.


> If you’re just handling requests there isn’t much for shared state

No, but if your single listener/server thread is managing epoll for all your file descriptors, you do have to have a way of synchronizing the worker threads with it, so they know when and when not to read from/write to their fd's. I assume Rachel is using some kind of semaphore or other threading synchronization mechanism for this.


Right, there is some shared state, but it’s very minimal.




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

Search: