SlideShare a Scribd company logo
1 of 12
Download to read offline
LINUX AYGIT SURUCUSU
GELISTIRME
Dursun Can TURAN
BRAXP Bilişim Sistemleri
ONCEKI DERS NE YAPTIK
• Kernel debug etme yöntemleri
• “Kernel hacking” opsiyonları
• Loglama ve mesaj limitleme
• OOPS mesajları ve donmalar
• Debug etme araçları
EŞZAMANLILIK NEDİR?
• Eşzamanlılık parallelizm değildir!
• SMP (Symmetric multiprocessing)
• Reentrant fonksiyonlar
• Preemptive vs Cooperative multitasking
EŞZAMANLILIK TEMELLERI
• Atomic
• Race Condition ve Critical Sections
• Deadlock nasıl oluşur?
• Mutex, Semaphore
• Spinlock
KERNEL EŞZAMANLILIK PRIMITIFLERI
• Tarihçe (BKL ve Fine vs Coarse-Grained Locking)
• Mutex, Semaphore
• Spinlock
KERNEL SEMAPHORE
• #include <asm/semaphore.h>
• void sema_init(struct semaphore *sem, int val);
• void down(struct semaphore *sem);
• int down_interruptible(struct semaphore *sem);
• int down_trylock(struct semaphore *sem);
• void up(struct semaphore *sem);
• R/W Semaphores
• void init_rwsem(struct rw_semaphore *sem);
• void down_read(struct rw_semaphore *sem);
• int down_read_trylock(struct rw_semaphore *sem);
• void up_read(struct rw_semaphore *sem);
• void down_write(struct rw_semaphore *sem);
• int down_write_trylock(struct rw_semaphore *sem);
• void up_write(struct rw_semaphore *sem);
• void downgrade_write(struct rw_semaphore *sem);
KERNEL MUTEX
• DECLARE_MUTEX(name);
• DECLARE_MUTEX_LOCKED(name);
• mutex_init(struct *mutex);
KERNEL SPINLOCK
• #include <linux/spinlock.h>
• spinlock_t my_lock = SPIN_LOCK_UNLOCKED;
• void spin_lock_init(spinlock_t *lock);
• void spin_lock(spinlock_t *lock);
• void spin_unlock(spinlock_t *lock);
• void spin_lock(spinlock_t *lock);
• void spin_lock_irqsave(spinlock_t *lock, unsigned long flags);
• void spin_lock_irq(spinlock_t *lock);
• void spin_lock_bh(spinlock_t *lock);
KERNEL SPINLOCK
• void spin_unlock(spinlock_t *lock);
• void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags);
• void spin_unlock_irq(spinlock_t *lock);
• void spin_unlock_bh(spinlock_t *lock);
• int spin_trylock(spinlock_t *lock);
• int spin_trylock_bh(spinlock_t *lock);
• R/W Spinlocks
• rwlock_t, __RW_LOCK_UNLOCKED, rwlock_init, read_lock, write_lock …
ALTERNATIF YONTEMLER
• Lock-free Algoritmalar
• Circular buffer kullanımı ve producer-consumer yapısı
• Atomic
• #include <asm/atomic.h>
• void atomic_set(atomic_t *v, int i);
• atomic_t v = ATOMIC_INIT(0);
• atomic_[read|add|sub|inc|dec|…]
• seqlock
• #include <linux/seqlock.h>
• seqlock_t, SEQLOCK_UNLOCKED, seqlock_init, read_seqbegin(_irqsave), read_seqretry(_irqrestore)
• write_seqlock(_irqsave|_irq|_bh), write_tryseqlock, write_sequnlock(_irqrestore|_irq|_bh)
• RCU (Read-Copy-Update)
• #include <linux/rcupdate.h>
• rcu_read_lock, rcu_read_unlock
• void call_rcu(struct rcu_head *head, void (*func)(void *arg), void *arg);
ÖZET VE KARŞILAŞTIRMA
• Mutex vs Semaphore
• Semaphore vs Spinlock
• Alternatif Yöntemlerin Avantaj ve Dezavantajları
ÖNÜMÜZDEKİ DERS
• Asenkronluk nedir ve nasıl sağlanır
• I/O bound vs CPU bound işlemler
• Schedulerlar ve I/O Modelleri
• Kernelda zaman kavramı
• İşlemlerin ötelenmesi

More Related Content

Recently uploaded

Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 

Recently uploaded (20)

Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 

Featured

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Featured (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Linux Sürücü Geliştirme - 06 Eşzamanlılık

  • 1. LINUX AYGIT SURUCUSU GELISTIRME Dursun Can TURAN BRAXP Bilişim Sistemleri
  • 2. ONCEKI DERS NE YAPTIK • Kernel debug etme yöntemleri • “Kernel hacking” opsiyonları • Loglama ve mesaj limitleme • OOPS mesajları ve donmalar • Debug etme araçları
  • 3. EŞZAMANLILIK NEDİR? • Eşzamanlılık parallelizm değildir! • SMP (Symmetric multiprocessing) • Reentrant fonksiyonlar • Preemptive vs Cooperative multitasking
  • 4. EŞZAMANLILIK TEMELLERI • Atomic • Race Condition ve Critical Sections • Deadlock nasıl oluşur? • Mutex, Semaphore • Spinlock
  • 5. KERNEL EŞZAMANLILIK PRIMITIFLERI • Tarihçe (BKL ve Fine vs Coarse-Grained Locking) • Mutex, Semaphore • Spinlock
  • 6. KERNEL SEMAPHORE • #include <asm/semaphore.h> • void sema_init(struct semaphore *sem, int val); • void down(struct semaphore *sem); • int down_interruptible(struct semaphore *sem); • int down_trylock(struct semaphore *sem); • void up(struct semaphore *sem); • R/W Semaphores • void init_rwsem(struct rw_semaphore *sem); • void down_read(struct rw_semaphore *sem); • int down_read_trylock(struct rw_semaphore *sem); • void up_read(struct rw_semaphore *sem); • void down_write(struct rw_semaphore *sem); • int down_write_trylock(struct rw_semaphore *sem); • void up_write(struct rw_semaphore *sem); • void downgrade_write(struct rw_semaphore *sem);
  • 7. KERNEL MUTEX • DECLARE_MUTEX(name); • DECLARE_MUTEX_LOCKED(name); • mutex_init(struct *mutex);
  • 8. KERNEL SPINLOCK • #include <linux/spinlock.h> • spinlock_t my_lock = SPIN_LOCK_UNLOCKED; • void spin_lock_init(spinlock_t *lock); • void spin_lock(spinlock_t *lock); • void spin_unlock(spinlock_t *lock); • void spin_lock(spinlock_t *lock); • void spin_lock_irqsave(spinlock_t *lock, unsigned long flags); • void spin_lock_irq(spinlock_t *lock); • void spin_lock_bh(spinlock_t *lock);
  • 9. KERNEL SPINLOCK • void spin_unlock(spinlock_t *lock); • void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags); • void spin_unlock_irq(spinlock_t *lock); • void spin_unlock_bh(spinlock_t *lock); • int spin_trylock(spinlock_t *lock); • int spin_trylock_bh(spinlock_t *lock); • R/W Spinlocks • rwlock_t, __RW_LOCK_UNLOCKED, rwlock_init, read_lock, write_lock …
  • 10. ALTERNATIF YONTEMLER • Lock-free Algoritmalar • Circular buffer kullanımı ve producer-consumer yapısı • Atomic • #include <asm/atomic.h> • void atomic_set(atomic_t *v, int i); • atomic_t v = ATOMIC_INIT(0); • atomic_[read|add|sub|inc|dec|…] • seqlock • #include <linux/seqlock.h> • seqlock_t, SEQLOCK_UNLOCKED, seqlock_init, read_seqbegin(_irqsave), read_seqretry(_irqrestore) • write_seqlock(_irqsave|_irq|_bh), write_tryseqlock, write_sequnlock(_irqrestore|_irq|_bh) • RCU (Read-Copy-Update) • #include <linux/rcupdate.h> • rcu_read_lock, rcu_read_unlock • void call_rcu(struct rcu_head *head, void (*func)(void *arg), void *arg);
  • 11. ÖZET VE KARŞILAŞTIRMA • Mutex vs Semaphore • Semaphore vs Spinlock • Alternatif Yöntemlerin Avantaj ve Dezavantajları
  • 12. ÖNÜMÜZDEKİ DERS • Asenkronluk nedir ve nasıl sağlanır • I/O bound vs CPU bound işlemler • Schedulerlar ve I/O Modelleri • Kernelda zaman kavramı • İşlemlerin ötelenmesi