0 votes 0 votes A printf or malloc takes the process to what state? Running Ready Suspended Terminated Operating System operating-system process + – Balaji Jegan asked Oct 16, 2018 • recategorized Aug 7, 2022 by Shubham Sharma 2 Balaji Jegan 399 views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply Dharmendra Lodhi commented Oct 16, 2018 reply Follow Share I think Block state because printf make use of I/O device 0 votes 0 votes rsansiya111 commented Dec 19, 2022 reply Follow Share It is not accurate to say that a printf or malloc function changes the state of a process to "running." The state of a process refers to its current status in the operating system's process table, and a process can be in one of several states, including running, ready, suspended, and terminated. A process can be in the "running" state if it is currently being executed by a processor. However, a printf or malloc function does not directly affect the state of a process. These functions are simply part of the process's execution and perform specific tasks, such as printing output or allocating memory. The state of a process can be changed by various events, such as the process being assigned to a processor to run, being preempted by another process, or being terminated by the operating system. Therefore, the correct answer to the question "A printf or malloc takes the process to what state?" is not "running." Instead, the correct answer depends on the context in which the printf or malloc function is being called and the current state of the process. 0 votes 0 votes DAWID15 commented Dec 19, 2022 reply Follow Share It can be it suspended(blocked) state. All I know is printf will invoke a system call and so this process will be loaded into stack. Now the user mode will be changed to kernal mode to execute the system call(here print something on screen). While this system call will be executing the process will be in blocked state(as it a state where I/O operations are performed). 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Is the answer is running , as in Malloc it required some ant of heap from main memory to allocate , it can be done while running , and print is also a process to print some statement or values,Please me if i m wrong Rakmo answered Dec 19, 2022 Rakmo comment Share Follow See all 0 reply Please log in or register to add a comment.