I've been developing an OS lately in C. But how can I shutdown the computer? By saying 'shutdown the computer', I mean a force shutdown.
How can I do that in C kernel development?
Any help would be appreciated.
Shutdown computer, how operating systems achieve it? (C Kernel development)
1.2k Views Asked by FastDeveloper At
1
There are 1 best solutions below
Related Questions in C
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in OPERATING-SYSTEM
- the end of the I/O operation is notified to the system by an interrupt.how much system time do the mentioned operations occupy?
- Problem on CPU scheduling algorithms in OS
- OS-wide text autocomplete service with popup
- mkssecreenshotmgr taking a screenshot
- How to prevent app from crashing on android emulator
- Is there a function to end a child process?
- Swapping a healthy and unallocated partition in Windows 10
- ubuntu OS : Why my battery is completely drained of in just 2 hours in suspend mode
- 1 filenames = [] 2 ----> 3 for file in os.zipfile('images.zip'):
- Worth it to access data by blocks on modern OS/hardware?
- How does outlook disable screenshot
- How can I enable my app to access a specific partition directory for reading and writing without showing popup to user?
- Exception of type 'System.Exception' was thrown. Error in Cosmos Project
- Maximum CPU Voltage reading
- Java: get username from uid
Related Questions in KERNEL
- Simulate WeChat scanning short connection redirection, but the QQ display result is different from WeChat?
- Validating a client from kernel in Windows
- Yocto kernel patch fails with git am
- Nuke BlinkScript: Why does the convolution kernel scale down the image?
- EKS AMI kernel debug symbols
- Unexpected OS Shutdown
- create_ap wlan0: Could not connect to kernel driver
- QEMU i386 pmio addresses
- Simple programming of VGA cursor
- How to compile and install kernel modules with dependencies and device tree?
- android camera driver rotate 90°
- Is there any way to get the WiFi contention window (CW) min and max value in Linux 80211 subsystem?
- How to reduce cached memory used by Linux kernel on embedded linux platform
- How can I get current cpufreq in kernel code?
- Print Inode or file data, using path name
Related Questions in SYSTEM-SHUTDOWN
- Timing issue while looping over the testing tool command line process
- Windows Shutdown Messages
- How to Detect System Shutdown in WPF App's OnExit Method?
- Is there any way to cold reboot via software?
- Phantom shutdown every Sunday midnight
- Preventing Windows shutdown in Rust
- Windows shut down through python
- Programmatically, how can I tell on LINUX that the system is rebooting?
- suspending a process for a while and then resume the same process programing
- Shut down Windows programmatically and wait for termination of resident processes
- what does shutdown -p command do?
- Python: throw exception in main thread on Windows shutdown (similar to Ctrl+C)
- How to programmatically find Android's last shutdown datetime?
- what is the shutdown code in the android studio?
- Is there a way to detect a System-Shutdown from a .net C# Console App and delay the shutdown until your program can gracefully exit?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
To sum up all the comments in an answer so it stays:
The modern way (circa 2020) to handle power management and shutdown is to use the Advanced Configuration and Power Interface (ACPI), see for example Getting Started With ACPI and OS Shutdown.
Source: Advanced Configuration and Power Interface (ACPI) Specification, Version 6.3 January 2019
This answer provides the historical background on the problem of OS controlling computer power and shutdown, and why it has taken so long to achieve some standard. Quoting:
Here is a Microsoft patent from the 90's for software-controlled computer hibernation which is related to software-controlled power management.
Effectively, software-controlled shutdown is a kind of simulation of shutdown, as real shutdown takes place when hardware power is actually switched off. Soft shutdown effectively is to make computer do absolutely nothing and consume as less power as possible. So OS makes sure to end all processes and make the CPU go to specific OS routines that simulate a shutdown (note: this state usually cannot be reversed except by a hardware interrupt of restart). Whether the OS routines that make soft-shutdown use ACPI or some other method/interface to simulate is another issue.
This post describes, roughly in outline, the shutdown process of the linux kernel, to get an idea.