Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linux 0.11 ÄÚºËѧϰ buffer.c


/*
 * buffer.c ³ÌÐòÓÃÓÚ¶Ô¸ßËÙ»º³åÇø(³Ø)½øÐвÙ×÷ºÍ¹ÜÀí¡£¸ßËÙ»º³å
 * ÇøλÓÚÄں˴úÂëºÍÖ÷ÄÚ´æÇøÖ®¼ä¡£
 *
 *  |---|---|------------------|---------------------|-------------------|
 *  |   |   |    *   *    *    |       buffer        |                   |
 *  |---|---|------------------|---------------------|-------------------|
 *    |                                   /|\
 *    |------------------------------------|
 *   \|/
 *  buffer_head (list)
 */
/*
 *  linux/fs/buffer.c
 *
 *  (C) 1991  Linus Torvalds
 */
/*
 *  'buffer.c' implements the buffer-cache functions. Race-conditions have
 * been avoided by NEVER letting a interrupt change a buffer (except for the
 * data, of course), but instead letting the caller do it. NOTE! As interrupts
 * can wake up a caller, some cli-sti sequences are needed to check for
 * sleep-on-calls. These should be extremely quick, though (I hope).
 */
/*
 * NOTE! There is one discordant note here: checking floppies for
 * disk change. This is where it fits best, I think, as it should
 * invalidate changed floppy-disk-caches.
 */
#include <stdarg.h>
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <asm/io.h>
extern int end; // ÓÉÁ¬½Ó³ÌÐòld Éú³ÉµÄ±íÃ÷³ÌÐòÄ©¶ËµÄ±äÁ¿£¬´ú±íµÄÊÇÒ»¸öÄÚ´æµØÖ·
struct buffer_head * start_buffer = (struct buffer_head *) &end;
struct buffer_head * hash_table[NR_HASH];
static struct buffer_head * free_list;
static struct task_struct * buffer_wait = NULL;
int NR_BUFFERS = 0;
/*µÈ´ýÖ¸¶


Ïà¹ØÎĵµ£º

linuxÃüÁîµÄÈ«³Æ~~~·

תÔØ×Ô£ºhttp://www.91linux.com/html/article/go/20090205/15634.html
bin = BINaries £¨binary)
/dev = devices
/etc = ETCetera
etcetera¸½¼ÓµÄÈË, ¸½¼ÓÎï, ÒÔ¼°ÆäËü, µÈµÈ
/lib = LIBrary
/proc = PROCesses
/sbin
= Superuser BINaries
/tmp = TeMPorary
/usr = Unix Shared
Resources
/var = ......

Linux ³£¼ûÎļþÀàÐÍ 02/07/10

ѹËõºÍ´ò°üÎļþ
¡¡¡¡* .bz2 — ʹÓÃbzip2ÃüÁîѹËõµÄÎļþ£¬¿ÉÒÔʹÓÃbzip2 -d filename ½â°ü
¡¡¡¡* .gz — ʹÓÃgzipÃüÁîѹËõµÄÎļþ£¬¿ÉÒÔʹÓÃgunzip -d filename ½â°ü
¡¡¡¡* .tar — ʹÓÃtar´ò°üµÄÎļþ£¬¼´tarballÎļþ£¬¿ÉÒÔʹÓÃtar xf filename ½â°ü
¡¡¡¡* .tbz — ʹÓÃtar´òÍê°üºóÔÙÒÔbzip2ÃüÁ ......

linuxÌõ¼þ±äÁ¿Àý³Ì

#include
#include
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
void *thread1(void *);
void *thread2(void *);
int i=1;
main(void)
{
pthread_t t_a;
pthread_t t_b;
pthread_create(&t_a,NULL,thread1,(void *)NULL) ......

Linux´óʦ£¨¹Å³£¬Guru£©ÍƼöʲô£¿






<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
       ÔÚÏÖʵÉú»îÖб»ÈËÃdzÆΪ´óʦ¼¶µÄÈËÎïȷʵºÜÉÙ¼û¡£
Brian
Proffitt
ÏÈÉú¾ÍÊÇһλȫÇòÖªÃû¡¢ÊÜÈË×ð¾´µÄ
Linux
´óʦ¡£´ËÑÔÓкθù¾Ý£¿½üÈÕ£¬ËûÏòÎÒÃÇÍƼöÁËʲô£¿
 
   ......

linux 0.11 ÄÚºËѧϰ truncate.c


/*
 * ¸ÃÎļþÖ÷ҪʵÏÖµÄÊÇtruncateº¯Êý£¬¸Ãº¯ÊýÊÇÊÍ·ÅÖ¸¶¨i 
 * ½ÚµãÔÚÉ豸ÉÏÕ¼ÓõÄËùÓÐÂß¼­¿é£¬°üÀ¨Ö±½Ó¿é¡¢Ò»´Î¼ä
 * ½Ó¿éºÍ¶þ´Î¼ä½Ó¿é
 */
/*
 *  linux/fs/truncate.c
 *
 *  (C) 1991  Linus Torvalds
 */
#include <linux/sched.h>
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ