3 ms·
you don't need parallelism in order to create deadlocks or race conditions
by entelechy 8y ago
you don't need parallelism in order to create deadlocks or race conditions
- ChrisSD 8y agoI'm sorry but I'm not sure how a single threaded program can have race conditions? Surely the very definition of a race condition excludes the possibility? Or are our definitions different?
- TeMPOraL 8y agoThe event loop stops being deterministic if you start triggering events based on a clock. Or if you have calls blocking on external resources with unpredictable timing. Say, you have a code like this: asynchronously doA(); blockReadingFile(); doB(); Whether doA() is finished or not when doB() executes depends on internals of doA() and on how long blockReadingFile() takes.
- kbumsik 8y agoIn general async executions really are big sources of race conditions in single threaded program. JS avoids this problem by blocking/queuing tasks until the current task is done but this is not the case in most lower-level environments. 1. Reentrancy. Flow of tasks can be interrupted by hardware interrupts and OS signals. In that case race conditions can happen by interrupt handlers. Bare metal embedded system programmers often have big headaches because of this. 2. JS implementations and JS API design can have race condition bugs. So JS API designers have to consider it. One of example is because of the order of queuing tasks/handlers. [1] [1]: https://github.com/w3c/mediacapture-record/issues/150#issuecomment-428104992 https://github.com/w3c/mediacapture-record/issues/150#issuec...
- sedeki 8y agoWhere did he mention ”parallelism”?