SlideShare a Scribd company logo
 Previously we studied a software based solution to critical
section problem (Peterson solution).
 Many systems provide hardware support for critical section
code.
 Uniprocessors – We could disable interrupts for preamption so
when a shared data is being modified no preamption will occur.
◦ Generally too inefficient on multiprocessor systems.
Disabling interrupts on a multiprocessor is very time
consuming, as the message is passed to all the processors
 Modern machines provide special atomic hardware instructions
 Atomic = non-interruptable
 The important characteristic is that this instruction is executed
atomically.
 If two TestAndSet C) instructions are executed simultaneously
(each on a different CPU), they will be executed sequentially in
some arbitrary order.
boolean TestAndSet (boolean *target)
{
boolean rv = *target;
*target = TRUE;
return rv:
}
 If the machine supports the TestAndSet () instruction, then we
can implement mutual exclusion by declaring a global Boolean
variable lock, initialized to false.
 Solution using TestAndSet
 Shared boolean variable lock is initialized to false.
do {
while ( TestAndSet (&lock ))
; /* do nothing
// critical section
lock = FALSE;
// remainder section
} while ( TRUE);
Another synchronization tool is called semaphore. A semaphore S
is an integer variable that is accessed only through two standard
atomic operations: wait () and signal ().
 Wait is represented by P() and signal by V().
 Binary semaphore – integer value can range only between 0
and 1; can be simpler to implement
◦ Also known as mutex locks
 Counting semaphore – integer value can range over an
unrestricted domain.
◦ Used to control access to a given resource consisting of a finite number of
instances.
◦ Semaphore is initialized to the number of resources available. Each process
performs a waitQ operation on the semaphore (thereby decrementing the
count).
◦ When a process releases a resource, it performs a signal () operation
(incrementing the count).
◦ When the count for the semaphore goes to 0, all resources are being used.
After that, processes that wish to use a resource will block until the count
becomes greater than 0.
 Mutual Exclusion
 We can use binary semaphores to deal with the critical-section
problem for multiple processes. The n processes share a binary
semaphore (mutex lock) initialized to 1.
 Each process P, is organized as shown
◦ Semaphore S; // initialized to 1
◦ wait (S);
Critical Section
signal (S);
 Implementation– Main disadvantage of the semaphore
definition given previously is that every process waiting for
semaphore loops continuously in the entry code.
 Looping wastes CPU cycles that some other process might be
able to use productively. This type of semaphore is also called a
spinlock (process "spins" while waiting for the lock).
 To eliminate busy waiting when a process has to wait for
semaphore it is blocked.
 The block operation places a process into a waiting queue
associated with the semaphore. Hence a waiting process is not
scheduled so no cpu cycles are wasted.
 Implementation– semaphores under this definition is defined
as a "C" struct:
typedef struct {
int value;
struct process *list;
} semaphore;
 Implementation of wait:
wait (S){
S->value--;
if (S->value < 0) {
add this process to waiting
queue
block();
}
}
Implementation of signal:
Signal (S){
S->value++;
if (S->value <= 0) {
remove a process P from the
waiting queue
wakeup(P);
}
}
 The block() operation suspends the process that invokes it.
 The wakeup(P) operation resumes the execution of a blocked
process P. These two operations are provided by the operating
system as basic system calls.
 Note that, although under the classical definition of semaphores
with busy waiting the semaphore value is never negative, this
implementation may have negative semaphore values.
 If the semaphore value is negative, its magnitude is the number
of processes waiting on that semaphore.
 Deadlock – two or more processes are waiting indefinitely for an
event that can be caused by only one of the waiting processes
 Let S and Q be two semaphores initialized to 1
P0 P1
wait (S); wait (Q);
wait (Q); wait (S);
. .
. .
. .
signal (S); signal (Q);
signal (Q); signal (S);
 Starvation – indefinite blocking. A process may never be
removed from the semaphore queue in which it is suspended.
 May occur if we add and remove processes from the list associated
with a semaphore in LIFO (last-in, first-out) order.

More Related Content

Similar to Lecture18-19 (1).ppt

Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"
Ra'Fat Al-Msie'deen
 
Operating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and DeadlocksOperating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and Deadlocks
Mukesh Chinta
 
Mca ii os u-2 process management & communication
Mca  ii  os u-2 process management & communicationMca  ii  os u-2 process management & communication
Mca ii os u-2 process management & communication
Rai University
 
Java util concurrent
Java util concurrentJava util concurrent
Java util concurrent
Roger Xia
 
Monitor(karthika)
Monitor(karthika)Monitor(karthika)
Monitor(karthika)Nagarajan
 
6.Process Synchronization
6.Process Synchronization6.Process Synchronization
6.Process Synchronization
Senthil Kanth
 
Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010
敬倫 林
 
Dot net parallelism and multicore computing
Dot net parallelism and multicore computingDot net parallelism and multicore computing
Dot net parallelism and multicore computingAravindhan Gnanam
 
Notes about concurrent and distributed systems & x86 virtualization
Notes about concurrent and distributed systems & x86 virtualizationNotes about concurrent and distributed systems & x86 virtualization
Notes about concurrent and distributed systems & x86 virtualization
Alessio Villardita
 
Ch7 OS
Ch7 OSCh7 OS
Ch7 OSC.U
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
Ahmad Alarbeed
 
AMC Minor Technical Issues
AMC Minor Technical IssuesAMC Minor Technical Issues
AMC Minor Technical Issues
Apache Traffic Server
 
Suyash Thesis Presentation
Suyash Thesis PresentationSuyash Thesis Presentation
Suyash Thesis PresentationTanvee Katyal
 
Bt0070
Bt0070Bt0070
Bt0070
Simpaly Jha
 
Lab3 testbench tutorial (1)
Lab3 testbench tutorial (1)Lab3 testbench tutorial (1)
Lab3 testbench tutorial (1)
Abhishek Bose
 
Concurrency: Mutual Exclusion and Synchronization
Concurrency: Mutual Exclusion and SynchronizationConcurrency: Mutual Exclusion and Synchronization
Concurrency: Mutual Exclusion and Synchronization
Anas Ebrahim
 

Similar to Lecture18-19 (1).ppt (20)

Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"
 
Operating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and DeadlocksOperating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and Deadlocks
 
Mca ii os u-2 process management & communication
Mca  ii  os u-2 process management & communicationMca  ii  os u-2 process management & communication
Mca ii os u-2 process management & communication
 
Java util concurrent
Java util concurrentJava util concurrent
Java util concurrent
 
Monitor(karthika)
Monitor(karthika)Monitor(karthika)
Monitor(karthika)
 
6.Process Synchronization
6.Process Synchronization6.Process Synchronization
6.Process Synchronization
 
Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010
 
Dot net parallelism and multicore computing
Dot net parallelism and multicore computingDot net parallelism and multicore computing
Dot net parallelism and multicore computing
 
Notes about concurrent and distributed systems & x86 virtualization
Notes about concurrent and distributed systems & x86 virtualizationNotes about concurrent and distributed systems & x86 virtualization
Notes about concurrent and distributed systems & x86 virtualization
 
Ch7 OS
Ch7 OSCh7 OS
Ch7 OS
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
AMC Minor Technical Issues
AMC Minor Technical IssuesAMC Minor Technical Issues
AMC Minor Technical Issues
 
Suyash Thesis Presentation
Suyash Thesis PresentationSuyash Thesis Presentation
Suyash Thesis Presentation
 
Distributed Operating System_2
Distributed Operating System_2Distributed Operating System_2
Distributed Operating System_2
 
test1_361
test1_361test1_361
test1_361
 
OS_Ch7
OS_Ch7OS_Ch7
OS_Ch7
 
OSCh7
OSCh7OSCh7
OSCh7
 
Bt0070
Bt0070Bt0070
Bt0070
 
Lab3 testbench tutorial (1)
Lab3 testbench tutorial (1)Lab3 testbench tutorial (1)
Lab3 testbench tutorial (1)
 
Concurrency: Mutual Exclusion and Synchronization
Concurrency: Mutual Exclusion and SynchronizationConcurrency: Mutual Exclusion and Synchronization
Concurrency: Mutual Exclusion and Synchronization
 

Recently uploaded

Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 

Recently uploaded (20)

Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 

Lecture18-19 (1).ppt

  • 1.
  • 2.  Previously we studied a software based solution to critical section problem (Peterson solution).  Many systems provide hardware support for critical section code.  Uniprocessors – We could disable interrupts for preamption so when a shared data is being modified no preamption will occur. ◦ Generally too inefficient on multiprocessor systems. Disabling interrupts on a multiprocessor is very time consuming, as the message is passed to all the processors  Modern machines provide special atomic hardware instructions  Atomic = non-interruptable
  • 3.  The important characteristic is that this instruction is executed atomically.  If two TestAndSet C) instructions are executed simultaneously (each on a different CPU), they will be executed sequentially in some arbitrary order. boolean TestAndSet (boolean *target) { boolean rv = *target; *target = TRUE; return rv: }
  • 4.  If the machine supports the TestAndSet () instruction, then we can implement mutual exclusion by declaring a global Boolean variable lock, initialized to false.  Solution using TestAndSet  Shared boolean variable lock is initialized to false. do { while ( TestAndSet (&lock )) ; /* do nothing // critical section lock = FALSE; // remainder section } while ( TRUE);
  • 5. Another synchronization tool is called semaphore. A semaphore S is an integer variable that is accessed only through two standard atomic operations: wait () and signal ().  Wait is represented by P() and signal by V().
  • 6.  Binary semaphore – integer value can range only between 0 and 1; can be simpler to implement ◦ Also known as mutex locks  Counting semaphore – integer value can range over an unrestricted domain. ◦ Used to control access to a given resource consisting of a finite number of instances. ◦ Semaphore is initialized to the number of resources available. Each process performs a waitQ operation on the semaphore (thereby decrementing the count). ◦ When a process releases a resource, it performs a signal () operation (incrementing the count). ◦ When the count for the semaphore goes to 0, all resources are being used. After that, processes that wish to use a resource will block until the count becomes greater than 0.
  • 7.  Mutual Exclusion  We can use binary semaphores to deal with the critical-section problem for multiple processes. The n processes share a binary semaphore (mutex lock) initialized to 1.  Each process P, is organized as shown ◦ Semaphore S; // initialized to 1 ◦ wait (S); Critical Section signal (S);
  • 8.
  • 9.  Implementation– Main disadvantage of the semaphore definition given previously is that every process waiting for semaphore loops continuously in the entry code.  Looping wastes CPU cycles that some other process might be able to use productively. This type of semaphore is also called a spinlock (process "spins" while waiting for the lock).  To eliminate busy waiting when a process has to wait for semaphore it is blocked.  The block operation places a process into a waiting queue associated with the semaphore. Hence a waiting process is not scheduled so no cpu cycles are wasted.
  • 10.  Implementation– semaphores under this definition is defined as a "C" struct: typedef struct { int value; struct process *list; } semaphore;  Implementation of wait: wait (S){ S->value--; if (S->value < 0) { add this process to waiting queue block(); } } Implementation of signal: Signal (S){ S->value++; if (S->value <= 0) { remove a process P from the waiting queue wakeup(P); } }
  • 11.  The block() operation suspends the process that invokes it.  The wakeup(P) operation resumes the execution of a blocked process P. These two operations are provided by the operating system as basic system calls.  Note that, although under the classical definition of semaphores with busy waiting the semaphore value is never negative, this implementation may have negative semaphore values.  If the semaphore value is negative, its magnitude is the number of processes waiting on that semaphore.
  • 12.  Deadlock – two or more processes are waiting indefinitely for an event that can be caused by only one of the waiting processes  Let S and Q be two semaphores initialized to 1 P0 P1 wait (S); wait (Q); wait (Q); wait (S); . . . . . . signal (S); signal (Q); signal (Q); signal (S);  Starvation – indefinite blocking. A process may never be removed from the semaphore queue in which it is suspended.  May occur if we add and remove processes from the list associated with a semaphore in LIFO (last-in, first-out) order.