Linux缘起-Linus'sunix
Linux Introduction
Paul LabLinux Revolution2
The Birth of Linux
Linux缘起-Linus'sunix
v1991年十月,一个名为LinusTorvalds的年轻芬兰大学生在
comp.os.minix这个新闻群组上发表了这样的一篇文
章:"Hello everybody out there using minix-I'm doing a
(free) operation system (just a hobby, won't be big and
professional like gnu) for 386(486) AT clones.",这个Linus
的兴趣(hobby)就是Linux核心程式0.02版的原始码.
v自这个0.02版的Linux核心程式公诸於世后,Internet上许多
高手相继地投注在Linux的相关开发,目前Linux已经成为非
常受人欢迎的一个多人多工,免费,稳定,效率高的作业系
统,可以在包括i386,Sparc,Alpha,Mips,Power PC等
等众多不同电脑系统平台上执行,蔚为风潮.
开放性原始码(Open Source)及
GPL(General Public License)
v开放性原始码很多,如BSD UNIX,X Window等等,Linux
的原始码可以轻易地取得,及自由地散布.但是让Linux能
风行的原因,应该是基於GNU通用公共许可证(GPL,
General Public License)的保护
v任何根据开放性原始码软体所做的任何修改,都有义务要再
开放这些修改后的原始码.如此一来,使得软体的智慧结晶
能够分享与累积,而开发者的努力也会有所保障,软体也能
更自由地散布.
vLinux即是遵循GPL的精神,而Linux上的软体,如Apache
server,Netscape等等也都遵循GPL的精神,而软体愈多,
使用者就愈多,开发的人愈多,开发的速度就愈快,Linux
也更加地完备,成为total solution,而蔚为风潮.
Linux Versions
vLinux distinguishes stable kernelsfrom
development kernels
vLinux version: X.Y.Z
X.Y: Version number
vIf the second number is even: stable kernel
vIf the second number is odd: development kernel
Z: release number
vFix bugs reported by Users
Features
vFree
vOpen system
vOpen source
vGNU GPL (General Public License)
vPOSIX standard
vHigh portability
vHigh performance
vRobust
vLarge development toolset
vLarge number of device drivers
vLarge number of application programs
System Features
vMulti-tasking
vMulti-user
vMulti-processor
vVirtual memory
vMonolithic kernel
vLoadable kernel modules
vNetworking
vShared libraries
vSupport different file systems
vSupport different executable file formats
vSupport different networking protocols
vSupport different processor architectures
Resources
vDistributions
RedHat,Slackware,OpenLinux,SuSE,Debian,
TurboLinux,Mandrake,Corel,Embedix
vBooks
vMagazines
The Linux Journal, Linux Magazine
vWeb sites
http://www.linux.org
http://www.linuxdevices.com/
User View of Linux OS
Hardware
Kernel
Shell
Applications
System Structure
System calls interface
File systems
ext2fsxiafsproc
minixnfsmsdos
iso9660
Task management
Scheduler
Signals
Loadable modules
Memory management
Central kernel
Machine interface
ipv4
ethernet
...
Network Manager
Peripheral managers
blockcharacter
sound cardcdromisdn
scsipci
netwo
rk
Buffer Cache
Processes
Machine
Linux Kernel Architecture
Kernel Source Code Organization
vSource code web site:
http://www.kernel.org
vSource code version:
X.Y.Z
2.2.17
2.4.18
Kernel Source Code Organization
Resources for Tracing Linux
vSource code browser
LXR (Source code navigator)
vBooks
Understanding the Linux Kernel, D. P. Bovetand M.
Cesati, O'Reilly & Associates, 2000.
Linux Core Kernel 0Commentary, In-Depth Code
Annotation, S. Maxwell, CoriolisOpen Press, 1999.
The Linux Kernel, Version 0.8-3, D. A Rusling, 1998.
Linux Kernel Internals, 2ndedition, M. Beck et al.,
Addison-Wesley, 1998.
Linux Kernel, R. Card et al., John Wiley & Sons, 1998.
Reentrant Kernels
vUnix kernels are reentrant
Several processes may be executing in
Kernel Mode at the same time
On uniprocessorsystems, only one
process can progress, but many may be
blocked in Kernel Mode waiting for some
events
Reentrant Kernels (Cont.)
vReentrant Functions
functions that only modify local variables but do
not alter global data structures
vTo provide reentrant kernel
Implement the kernel as a collection of reentrant
functions
Instead, Linux uses the nonreentrantfunctions
and locking mechanism
vTo ensure only one process can execute a nonreentrant
function at a time
Kernel Control Path
vA kernel control pathdenotes the sequence
of instructions executed by the kernel to
handle
System call
Exception
Interrupt
Synchronization and Critical
Regions
vImplement a reentrant kernel requires
synchronization
Different kernel control paths may access
the same kernel data structure
Called Race condition
This section of code is called a critical
region
Synchronization and Critical
Regions (Cont.)
vPossible solution
Atomic operation
vRead and decrement a variable with a single,
noninterruptibleoperation
However, many kernel data structures, e.g.
linked list, cannot be accessed with a
single operation
Synchronization and Critical
Regions (Cont.)
vSolutions
NonpreemptiveKernels
Interrupt disabling
Spin locks
NonpreemptiveKernels
vWhen a process executes in Kernel Mode, it
cannot be arbitrarily suspended and
substituted with another process
vIneffective in multiprocessor system
Two kernel control paths running on different
CPUs may concurrently access the same data
structure
Interrupt disabling
vApproach
Disable interrupts
Enter critical section
Reenableinterrupts
vIneffective if the critical region is large
vCannot work in a multiprocessor
system
Semaphores
vSemaphore
A counter
Has two atomicoperations
vUp
vDown
vEach semaphore is associated with a list of waiting
process
Link processes that are blocked
vEffective in both uniprocessorand multiprocessor
Spin Locks
vIn Multiprocessor, semaphores may be inefficient
if the time required to update the data structures is
short
Insert a process into a semaphore list is relative
expensive
vSpin lock
Executing a tight instruction loop until the lock becomes
open
vUsed in a multiprocessor system

301303 类型:pdf文档
立刻下载此文档