What is Critical section?
Answers were Sorted based on User's Feedback
Answer / dhruv
It is a section of code in the process which requires access
to only shared resources. It must not be executed while
another process another program is in the corresponding
section of code. It provides the mutual exclusion to the
processes.
Is This Answer Correct ? | 57 Yes | 7 No |
Answer / zahid
In concurrent programming a critical section is a piece of
code that accesses a shared resource (data structure or
device) that must not be concurrently accessed by more than
one thread of execution.
Is This Answer Correct ? | 32 Yes | 9 No |
Answer / mufti usmaan system analyst
In concurrent programming a critical section is a piece of
code that accesses a shared resource (data structure or
device) that must not be concurrently accessed by more than
one thread of execution. A critical section will usually
terminate in fixed time, and a thread, task or process will
have to wait a fixed time to enter it (aka bounded waiting).
Some synchronization mechanism is required at the entry and
exit of the critical section to ensure exclusive use, for
example a semaphore
Is This Answer Correct ? | 21 Yes | 5 No |
Answer / udipta bhuyan
In concurrent programming a critical section is a piece of
code that accesses a shared resource (data structure or
device) that must not be concurrently accessed by more than
one thread of execution. A critical section will usually
terminate in fixed time, and a thread, task or process will
have to wait a fixed time to enter it (aka bounded waiting).
Some synchronization mechanism is required at the entry and
exit of the critical section to ensure exclusive use, for
example a semaphore.
By carefully controlling which variables are modified inside
and outside the critical section (usually, by accessing
important state only from within), concurrent access to that
state is prevented. A critical section is typically used
when a multithreaded program must update multiple related
variables without a separate thread making conflicting
changes to that data. In a related situation, a critical
section may be used to ensure a shared resource, for example
a printer, can only be accessed by one process at a time.
How critical sections are implemented varies among operating
systems.
The simplest method is to prevent any change of processor
control inside the critical section. On uni-processor
systems, this can be done by disabling interrupts on entry
into the critical section, avoiding system calls that can
cause a context switch while inside the section and
restoring interrupts to their previous state on exit. Any
thread of execution entering any critical section anywhere
in the system will, with this implementation, prevent any
other thread, including an interrupt, from getting the CPU
and therefore from entering any other critical section or,
indeed, any code whatsoever, until the original thread
leaves its critical section.
Is This Answer Correct ? | 11 Yes | 2 No |
Answer / guest
A critical section of code is one in which data that may be
accessed by other threads are inconsistent. At a higher
level, a critical section can be viewed as a section of
code in which a guarantee you make to other threads about
the state of some data may not be true.
If other threads can access these data during a critical
section, your program may not behave correctly. This may
cause it to crash, lock up, produce incorrect results, or
do just about any other unpleasant thing you care to
imagine.
Other threads are generally denied access to inconsistent
data during a critical section (usually through use of
locks). If some of your critical sections are too long,
however, it may result in your code performing poorly
Is This Answer Correct ? | 53 Yes | 45 No |
Answer / sandeep kumar gautam
The critical-section problem is to design a
protocol that the processes can cooperate. The protocol
must ensure that when one process is executing in its
critical section, no other process is allowed to execute in
its critical section.
sandeep gautam
rits cs 2012
Is This Answer Correct ? | 9 Yes | 3 No |
Answer / avdhesh kumar
1. The critical-section problem is to design a
protocol that the processes can cooperate. The protocol
must ensure that when one process is executing in its
critical section, no other process is allowed to execute in
its critical section.
2. The critical section problem is to design a
protocol that the processes can use so that their action
will not depend on the order in which their execution is
interleaved (possibly on many processors).
Is This Answer Correct ? | 9 Yes | 4 No |
Answer / ahmad
Critical Section is a sequence of code that has exclusive
access to a shared resources.
Is This Answer Correct ? | 5 Yes | 0 No |
Ans:Critial section is the that contains such code that can
be executed separatedly no two codes can be executed
together.
Is This Answer Correct ? | 9 Yes | 6 No |
Answer / girajendra kumar
Necessary and sufficient conditions for a solution to the
c.s. problem:
1. Mutual Exclusion --- if is executing in one of its
critical sections, no , , is executing in its critical
sections.
2. Progress --- a process operating outside of its
critical section cannot prevent other processes from
entering theirs; processes attempting to enter their
critical sections simultaneously must decide which process
enters eventually.
3. Bounded Waiting --- a process attempting to enter
its critical region will be able to do so eventually.
Assumptions:
1. No assumptions made about relative speed of
processes
2. No process may remain in its critical section
indefinitely (may not terminate in its critical section)
3. A memory operation (read or write) is atomic ---
cannot be interrupted. For now, we do not assume
indivisible RMW cycles.
Is This Answer Correct ? | 20 Yes | 18 No |
what is Context switch?
How to work unix commands on windows xp without installing unix o/s in pc?
Explain what are the main families of threads?
Explain critical section?
Explain what is protection boundary?
What is the window of the working set of a process?
What is the working set of a process?
HOW can I work UNIX commands on Windows XP without installing UNIX O/S in PC
When should we use thread-safe "_r" library calls?
How would you kill a process?
what is Scheduling?
If your server is running on Unix and one of the sessions are keep on running without loading any data. how would you kill it?