Plan References CS 6560 Operating System Design

 www.phwiki.com

 

The Above Picture is Related Image of Another Journal

 

Plan References CS 6560 Operating System Design

Baylor College of Dentistry, US has reference to this Academic Journal, CS 6560 Operating System Design Lecture 6: Interrupts: Bottom Halves Kernel Synchronization References Our textbook: Robert Love, Linux Kernel Development, 2nd edition, Novell Press, 2005. Understanding the LINUX Kernel, 3rd. edition, O?Reilly, 2005. (covers 2.6) The kernel code in addition to its own documentation. Plan Chap 7: Bottom halves Chap 8: Concurrency Issues in addition to Principles Chap 9: Concurrency methods in Linux 2.6

 Toms, Justine Baylor College of Dentistry www.phwiki.com

 

Related University That Contributed for this Journal are Acknowledged in the above Image

 

Recall: Top in addition to Bottom Halves Conflicting needs in consideration of interrupts: Return quickly Get lots of work done Solution: Break up the interrupt processing into two parts Top half: returns quickly, after setting up work so that be done Bottom half: scheduled by the kernel so that get work done at a later time Bottom Halves Bottom Halves = General term in consideration of mechanisms so that defer work generated by interrupt handlers (also an old name in consideration of an obsolete mechanism in consideration of doing this) When so that run Bottom Half? When? In interrupt context – no sleeping allowed In process context – sleeping allowed Advantages so that each, thus Linux 2.6 offers both types of bottom halves.

Process in addition to Interrupt Contexts Process Context: Execution of code in the kernel that is scheduled by the process scheduler. Interrupt Context: Execution of code in the kernel that is responding so that an interrupt in addition to is not scheduled by the process scheduler. Bottom Half Mechanisms In Linux 2.6 The following are current mechanisms Softirq Tasklets Work queues Previous versions of the kernel had others that are now obsolete: BH – removed in 2.5 kernel Task queues – removed in 2.5 kernel Softirq Runs in interrupt context – no blocking allowed Statically defined at compile time – limited so that 32 Available since 2.3 version of kernel Handles a few special cases such as network in addition to scsi disk processing. Also handles tasklets Code is mainly in kernel/softirq.c (and other places such as include/linux/irq_cpustat.h)

Service Oriented Architecture Composite Services Architecture (CSA) SCA Specifications (1) SCA Specifications (2) SCA Specifications (3) SCA Specifications (4) SCA Components (1) SCA Components (2) SCA Components (3) SCA Components (4) SCA Components Quiz (1) SCA Components Quiz (2) SCA Composites (1) SCA Composites (2) SCA Composites (3) SCA Composites (4) SCA Composites (5) SCA Composites in ?Skiddle? SCA Domains SCA Bindings SCA Services, References & Properties SCA Summary Service Data Objects (SDO) Service Data Objects (SDO) Goals of SDO SDO Architecture (1) SDO Architecture(2) SDO Architecture(3) SCA in addition to JBI SCA in addition to JBI Bottom Line

Properties A softirq is never preempted by another softirq – only by an interrupt A softirq can run on more than one processor at a time. Implementation of Softirqs Data structure: softirq_action Has function reference in addition to data reference Static array of these: softirq_vec[32] Handler function has simple prototype: void softirq_handler(struct softirq_action *) Registering Softirqs Softirqs are enumerated at compile time They are registered via the open_softirq function. This just places them in the softirq_vec.

When do softirqs run? When needed, they are marked in consideration of running alongside the raise_softirq function. This turns on a bit in the softirq_pending word They are later run by the kernel alongside the do_softirq function. This is called in the return from hardware interrupt code in the ksoftirq kernel thread elsewhere such as in the networking subsystem Tasklets Tasklets is a system that is implemented on top of soft_irq. While soft_irqs are reserved in consideration of certain purposes, tasklets are the recommended way so that do low overhead bottom half processing. They are dynamically generated in addition to managed. Tasklet Operations Declaring: DECLARE_TASKLET in addition to DECLARE_TASKLET_DISABLED Scheduling (mark as pending): tasklet_schedule Disabling: tasklet_disable in addition to tasklet_disable_nosync Enabling: tasklet_enable Removing: tasklet_kill

Workqueues Workqueues run in process context in addition to contain a list of work so that be worked on. Each unit of work has a function in addition to a pointer so that some data. Each workqueue has a name, a list of work, in addition to a set of worker threads, one in consideration of each CPU. The threads are named after the name of the workqueue. Initially, there is one workqueue whose worker threads are called ?events?. Individual threads are called ?events/0?, ?events/1?, in addition to so on. Workqueue Operations Creating Workqueues: create_workqueue makes new workqueue alongside given name. Creating work: (give name, function, data) Statically: DECLARE_WORK Dynamically: INIT_WORK Schedule work: Generically: queue_work in addition to queue_delayed_work Default workqueue: schedule_work in addition to schedule_work_delayed Flush work: Generically: flush_workqueue Default workqueue: flush_scheduled_work Cancel work: cancel_delayed_work Kernel Synchronization Chapters 8 in addition to 9 Issue: Sharing data in a multiprocessor, preemptive environment Solutions: Limit sharing Use locks

Concurrency Issues True Concurrency: Multiple processors be running code at the same time. They may contend in consideration of the same data. Preemption: Running code may be interrupted by the running of other code. Running the new code may contend in consideration of the same data as running the old. Blocking in addition to Sleeping Blocking: Code may stop running in addition to be waiting in consideration of an event so that occur. Sleeping: This can only happen if there is a process that is executing it. Scalability Adding more processors adds more overhead. So a quad core system does not run four times faster.

Granularity Graduality: How much data should be protected? Bits Words Structures Danger of Data Contention Danger of data contention is corruption. Example: updates – read, modify, write Solutions Don?t share: Don?t use global variables. Have separate copies of variables in consideration of each CPU Carefully design how data is shared in addition to use a variety of locking in addition to synchronization methods.

Basic Principles Protect data not code. Critical region: Code that accesses shared data Typical protection: bracket critical regions Linux 2.6 uses Per CPU copies of variables Preemption disabling Interrupt disabling atomic operations spinlocks Semaphores Completion variables Seq locks Barriers Per CPU Variables Covered under memory management in LKD, Chapter 11. Linux 2.4 used an explicit array, indexed by CPU. The function get_cpu gives the index number in consideration of the current CPU in addition to disables preemption. The function put_cpu enables preemption. Linux 2.6 has a percpu interface.

Atomic Operations Linux 2.6 has atomic integer variables in addition to atomic bitwise operations Atomic Integer Operations ATOMIC_INIT(int i)// assign the type atomic_t so that i int atomic_read(atomic_t *v)// returns value of v atomically void atomic_set(atomic_t *v, int i)// atomically sets v equal so that the value of I void atomic_add(int i, atomic_t *v)// atomically add i so that v void atomic_sub(int i, atomic_t *v)// atomically subtract i from v void atomic_inc(atomic_t *v)// atomically increment v void atomic_dec(atomic_t *v)// atomically decrement v And more – see page 133 in consideration of details on atomic_sub_and_test, atomic_add_negative, atomic_dec_and_test, atomic_inc_and_test Atomic Bitwise Operations Operations Set, clear in addition to flip individual bits Test in addition to set, clear, in addition to flip individual bits Return a bit value Find first set bit in addition to first cleared bit Atomic in addition to non-atomic forms (prefix by double underscore) Danger – bit position can overflow actual data

Spin Lock Methods spin_lock()// aquires spin lock spin_unlock()// releases spin lock spin_lock_irq() // disables local interrupts in addition to acquires spin lock spin_unlock_irq() // releases spin lock in addition to enables interrupts spin_lock_irqsave() // saves in addition to disables local interrupts, acquires spin lock spin_unlock_irqsave() // restores in addition to enables local interrupts in addition to releases spin lock spin_lock_init() spin_trylock() spin_is_locked() More Coming

Toms, Justine Golf Editor

Toms, Justine is from United States and they belong to Golf Editor and work for Arizona Foothills Magazine in the AZ state United States got related to this Particular Article.

Journal Ratings by Baylor College of Dentistry

This Particular Journal got reviewed and rated by Basic Principles Protect data not code. Critical region: Code that accesses shared data Typical protection: bracket critical regions Linux 2.6 uses Per CPU copies of variables Preemption disabling Interrupt disabling atomic operations spinlocks Semaphores Completion variables Seq locks Barriers Per CPU Variables Covered under memory management in LKD, Chapter 11. Linux 2.4 used an explicit array, indexed by CPU. The function get_cpu gives the index number in consideration of the current CPU in addition to disables preemption. The function put_cpu enables preemption. Linux 2.6 has a percpu interface. and short form of this particular Institution is US and gave this Journal an Excellent Rating.