Is there a way to design a Windows application so that it's ALWAYS responsive (to use input, etc.)
I'm sure every intermediate computer user, if not every computer user has experienced his operating system getting frozen because of some program either hogging all of the processing power or all of the memory. However, in almost all of these cases the mouse pointer is till responsive. You just can't click anything. So I'm wondering, is there a way use some low level input hooks that will fire immediately on input no matter what. Also, the application would need to be run in a separate thread/environment so that it always has precedence over other tasks that might potentially be freezing the OS. The Windows in the title is because I don't really use Linux so I don't know if things like these happen everywhere. Now, I assume that the answer is no, seeing how programs like task manager would be the first candidates for that kind of a functionality and MS should be the the people most apt at implementing it in their own OS. So if the answer is indeed no, then the question becomes, why. Is there some fundamental reason that this can't be done? A separate layer of high priority applications that only the applications approved by the user can use.
There are two kinds of problems and one has to distinguish between them: One application is unresponsive, while the rest of the system is responsive. This is due to bad design that blocks the GUI thread. The entire system is unresponsive. This is usually due to memory pressure and running out of physical RAM. While the executable pages are being shuffled in from the swap area, the CPU can't do much but execute the kernel, the latter being largely non-paged. Mouse pointers are often managed entirely in the kernel space. There are well understood solutions to both problems. The first one involves writing software like it was 2014, not 1995 (using libdispatch-style async threading etc.). The second one involves getting hardware commensurate with one's requirements/needs. So yes, it is possible to design such an application as long as it runs on hardware that has enough resources (processing cores, RAM, etc.) to support its operation efficiently. There are no guarantees of course, since it does run in userspace after all, so its latency to user input may be curtailed by buggy drivers and such. If you want guarantees, run on a realtime operating system, but there you can sometimes get exactly what you wish for: a misbehaving application, aided by an efficient kernel, can very quickly run out of system resources and trigger a watchdog reboot.
It might not be the perfect answer or accurate but I'm gonna write some ideas. If you have some freezes in your application, it's usually because something went bad on your system (low memory, HD failure, process requiring a lot of CPU, etc). I don't see how you would be able to get a higher priority for an app that superseed any other applications, even those in high priority. The OS job is to allocate CPU time between applications. If it can't do the job it probably mean that it's impossible at the moment. Also, when the screen freeze, it's important to understand what exactly has frozen. If it's the UI rendering (which the mouse seems to be rendered by a different system than the one rendering applications), it might be impossible to do something. On probably all OS, there is only 1 UI thread. If it's frozen, it will be for all applications. And when the UI is locked, the input won't work either since the input is handled in the same thread. How to fix this? Probably not possible. Linux is better at handling these kind of UI issues because of how it's built, but it happens as well. The difference is that you can kill the UI and restart it without rebooting the machine. A good way to create applications today is to use the main thread to do all the basic stuff (UI/input) and do your processing in another thread. So, if the other thread hang or is too long, you can kill them without killing your app and leaving it responsive. Hope it answer some of your questions.
I'm sure every intermediate computer user, if not every computer user has experienced his operating system getting frozen because of some program either hogging all of the processing power or all of the memory. Actually no, not since NT/W2K. To completely freeze up the entire OS, you have to try quite hard, eg. create as many real-time, highest-priority threads as there are cores. Of course there are apps that become unresponsive, usually due to bad design that blocks the GUI thread, (as suggested by others), but that does not prevent other apps from running OK.
Producer consumer with semaphores
SAS: What is the difference between an X Statement and an X Command?
Calculating the size of an inverted page table
porting pintOS to Raspberry-pi
How does Test and Set Instruction provide Bounded Waiting in below code?
How does Virtualization works internally?
Software support multi-user in OS
MMU and Page Table
how virtual memory increases context switching overhead?
Which x64 Bit Host OS that can be equivalent to Bare Metal hypervisor and can run VirtualBox as well as VMWare software
Is the valid invalid bit a waste with respect to protection?
How many total number of processes are there?
Can Child Process and Parent Process run deterministically?
How to disable the sheet asking “Do you want to move the installer to the Trash?” after installation is complete
how to specify in test to use 'get file' from operating system library than ssh library in robotframework
What is Page fault service time?