Linux Kernel Development – Chapter 10

Kernel Synchronization Methods

My personal notes and summary from chapter 10 of the book Linux Kernel Development

Atomic Operations

  • Kernel provide two sets of interface for atomic operation : operate on integers, operate on bits
  • atomic_t: special type used to replace int in atomic operations. <linux/types.h>
    • easy identify of atomic operations
    • ensure the data type not passed to non-atomic operations
    • ensure compiler does not optimize in way to break atomic operation
    • hide architecture-specific differences of implementation
  • define atomic_t is done in usual manner
  • can use ATOMIC_INIT(0) to set a initial value
  • implementations of these operations can be found in <asm/atomic.h
    Continue reading

Linux Kernel Development – Chapter 8

Bottom Halves and Deferring Work

My personal notes and summary from chapter 8 of the book Linux Kernel Development

Bottom halves of interrupt handle work can’t be done in the Top halves.
Top halves should be used for work that is time sensitive, relates to the hardware, and need to ensure another interrupt does not interrupt the work

The Original “Bottom Half”

  • a list of 32 statically created BH
  • each BH represent by a bit in 32-bit integer
  • No two could run at same time
  • Pro: Simple
  • Con: inflexible and bottleneck

Continue reading

Linux Kernel Development – Chapter 7 Interrupts and Interrupt handlers

My personal notes and summary from chapter 7 of the book Linux Kernel Development

Side note: This post is written using Mou markdown editor, still playing around with the stylings. Can’t seem to ever get a good way to display code, the way I want it to. Just bare with me for now.

Interrupts and Interrupt Handlers

  • One of kernel’s purpose is to manage hardware
  • Hardware is slow compare to processor, resource wasted with naive implementation
  • One answer: polling
  • Better: interrupts
  • Linux kernel use special functions: interrupt handlers
  • Interrupt allow hardware to signal events to processor
  • Different device can be associated with different interrupts values, Interrupt request (IRQ) lines
  • Exception are produces by processor during code execution, similar to interrupt
  • Interrupt handler is hardware specific, and part of drivers
  • handlers are invoked by kernel as respond to interrupt, run in interrupt context
  • Handlers need to be FAST
  • Interrupt Top Halves is the handler. Acknowledge and go
  • Interrupt Bottom Halves any work performed later
  • Driver register interrupt handler:

    Continue reading

The Iphone 5

Unless you have been living under a rock, you would have heard the new Iphone 5 is out.
And the world is going crazy over it.

Unless the previous Iphones, this time I actually seriously considered getting it. Note I have only considered the idea.

I am at a point in my life where I need a new phone. My old Nexus S is getting sluggish, being only almost two years old it is kind disappointing. Me being a long time Android user and who makes a living on developing Android kernels, I naturally start looking at all the top of the line Android phones. And they all seemed to have one thing in common, the screen size for all of them is at least 4.3 inch, almost around 4.7 inch mark.

My first ever cell phone was a Sony Ericsson W580. It was a nice phone back in the days, but the main reason I got it was because of it’s form factor. IT WAS SMALL. What happened to that. I remembered there was a time phone manufacture aimed for small. I really miss that. My first smart phone was the HTC Desire. And I loved everything about that phone: the 3.7 inch display; the metallic frame; the optical curser. It was in a way perfect for me.

I am not saying that big phones are bad, but I personally don’t like it. If I want a big screen device I would use my Nexus 7 tablet for it, or use my laptop which both I carry with my everywhere anyway. So I would just need a small device that can be with me all the time to do phone calls, text, and check emails.

So that is why I was seriously considering getting a Iphone, because it is the only smart phone out there that still have a small form factor. 4 inch screen is still very desirable compare to the other choices.

After doing a lot of research, all the phone plans are ridiculously expensive. In the end I think I am just going to get a unlocked Iphone 4s and get a pre-paid AT&T plan. But I would really like to see trend for small phones to come back.

Maybe the only reason I like small phones is because I am not trying to compensate for anything! :p