⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 start

📁 UNIX v6源代码 这几乎是最经典的unix版本 unix操作系统设计和莱昂氏unix源代码分析都是用的该版
💻
📖 第 1 页 / 共 2 页
字号:
c.c created above.This is the majordevice switch of each device class (block and character).There is one line for each device configured in your systemand a null line for place holding for those devicesnot configured.The block special devices are put in firstby executing the following generic commandfor each disk or tape drive.(Note that some of these files already existin the directory /dev.Examine each file with ls-I with \-l flag tosee if the file should be removed.).DS	/etc/mknod /dev/NAME b MAJOR MINOR.DEThe NAME is selected from the following list:.DSc.c	NAME	devicerf	rf0	RS fixed head disktc	tap0	TU56 DECtaperk	rk0	RK03 RK05 moving head disktm	mt0	TU10 TU16 magtaperp	rp0	RP moving head diskhs	hs0	RS03 RS04 fixed head diskhp	hp0	RP04 moving head disk.DEThe major device number is selected by counting theline number (from zero)of the device's entry in the block configuration table.Thus the first entry in the table bdevsw would bemajor device zero..PPThe minor device is the drive number,unit number or partition as describedunder each device in section IV.The last digit of the name(all given as 0 in the table above)should reflect the minor device number.For tapes where the unit is dial selectable,a special file may be made for each possibleselection..PPThe same goes for the character devices.Here the names are arbitrary except thatdevices meant to be usedfor teletype access should be named/dev/ttyX, where X is any character.The files tty8 (console), mem, kmem, null arealready correctly configured..PPThe disk and magtape drivers provide a `raw' interfaceto the device which provides direct transmissionbetween the user's core and the device and allowsreading or writing large records.The raw device counts as a character device,and should have the name of the correspondingstandard block special file with `r' prepended.Thus the raw magtapefiles would be called /dev/rmtX..PPWhen all the special files have been created,care should be taken to changethe access modes (chmod-I)on these files to appropriate values..SHThe Source Disk.PPYou should now extract the source disk.This can be done as described aboveor the UNIX command dd-I may be used.The disk image begins at block 4100 on the tape,so the command.DSdd if=/dev/mt0 of=/dev/rk1 count=4000 skip=4100.DEmight be used to extract the diskto RK drive 1..PPThis disk should be mounted (mount-VIII) on /usr/source; it containsdirectories of source code.In each directory is a Shell file run thatwill recompile all the source in the directory.These run files should be consulted wheneveryou need to recompile..SHFloating Point.PPUNIX only supports the 11/45 FP11-Bfloating point unit.For machines without this hardware,there is a user subroutineavailable that will catch illegal instructiontraps and interpret floating point operations.(See fptrap-III.)The system as delivered has this code includedin all commands that have floating point.This code is never used if the FP hardwareis available and therefore does notneed to be changed.The penalty is a little bit of disk space andloading time for the few floating commands..PPThe C compiler in /usr/source/c probablyshould be changed if floating point is available.The fpp flag in c0t.s should be set andC should be recompiled and reloaded andinstalled.This allows floating point C programs to becompiled without the \-f flag and preventsthe floating point interpreter from gettinginto new floating programs.(See /usr/source/c/run.).SHTime Conversion.PPIf your machine is not in the Eastern time zone,you must edit (ed-I) the subroutine/usr/source/s4/ctime.c to reflect your local time.The variable `timezone' should be changedto reflect the time difference between local time and GMT.For EST, this is 5*60*60; for PST it would be 8*60*60.This routine also contains the names of thestandard and Daylight Savings time zone;so `EST' and `EDT' might be changed to `PST' and `PDT'respectively.Notice that these two names are in upper caseand escapes may be needed (tty-IV).Finally, there is a `daylight'flag;when it is 1 it causes thetime to shift to Daylight Savings automaticallybetween the last Sundays in April and October(or other algorithms in 1974 and 1975).Normally this will not have to be reset.After ctime.c has been editedit should be compiled and installed inits library.(See /usr/source/s4/run.)Then you should(at your leisure)recompile and reinstallall programs performing time conversion.These include:(in s1)date, dump, ls, cron,(in s2)mail, pr, restor, who, sa and tp..SHDisk Layout.PPIfthere are to be more file systems mounted than just the root,use mkfs-VIII to create the new file system andput its mounting in the file /etc/rc (see init-VIII and mount-VIII).(You might look at /etc/rc anyway tosee what has been provided for you.).PPThere are two considerations in deciding how to adjust the arrangementof things on your disks:the most important is making sure there is adequate spacefor what is required;secondarily, throughput should be maximized.The RK disk (or its image)as distributed has 4000 blocks for file storage,and the remainder of the disk (872 blocks)is set aside for swap space.In our own system, which allows 14 simultaneous users,this amount of swap space is not quite enough,so we use 1872 blocks for this purpose;it is large enough so running out of swap space neveroccurs..PPMany common system programs (C, the editor, the assembler etc.)create intermediate files in the /tmp directory,so the file system where this is stored also should be madelarge enough to accommodatemost high-water marks.In an idle state, we have about 900 free blockson the file system where /tmp resides,and hit the bottom every few days or so.(This causes a momentary disruption,but not a crash, as swap-space runout does.)All the programs that create files in /tmp try to takecare to delete them, but most are not immune toevents like being hung up upon, and can leave dregs.The directory should be examined every so often and the oldfiles deleted..PPExhaustion of user-file space is certain to occurnow and then;the only mechanisms for controlling this phenomenonare occasional use of du-I and threateningmessages of the day and personal letters..PPThe efficiency with which UNIX is able to use the CPUis largely dictated by the configuration of disk controllers.For general time-sharing applications,the best strategy is to try to split user files,the root directory (including the /tmp directory)and the swap area among three controllers.In our own system, for example, we have user files on an RP,the root on an RF fixed-head disk, and swap on an RK.This is best for us since the RK has a faster transferrate than the rather slow RF, and in swappingthe transfer rate rather than access timeis the dominant influence on throughput..PPOnce you have decided how to make best useof your hardware, the question is how to initialize it.If you have the equipment,the best way to move a file systemis to dump it (dump-VIII) to magtape,use mkfs-VIII to create the new file system,and restore the tape.If you don't have magtape,dump accepts an argument telling where to put the dump;you might use another disk or DECtape.Sometimes a file system has to be increased in logical sizewithout copying.The super-block of the device has a wordgiving the highest address which can be allocated.For relatively small increases, this word can be patchedusing the debugger (db-I)and the free list reconstructed using icheck-VIII.The size should not be increased very greatlyby this technique, however,since although the allocatable space will increasethe maximum number of files will not (that is, the i-listsize can't be changed).Read and understand the description given in file system-VIbefore playing around in this way..PPIf you have only an RP disk,see section rp-IV for some suggestionson how to lay out the information on it.The file systems distributed on tape, containing the binary, the source,and the manuals,are each only 4000 blocks long.Perhaps the simplest way to integrate the latter twointo a large file system is to extract thetape into the upper part of the RP,dump it,and restore it into an empty, non-overlappingfile system structure.If you have to merge a file system into another, existing one,the best bet is touse ncheck-VIIIto get a list of names, then edit this listinto a sequence of mkdir and cp commandswhich will serve as input to the Shell.(But notice that owner information islost.).SHNew Users.PPInstall new users by editing the password file/etc/passwd (passwd-V).You'll have to make current directories for the new usersand change their owners to thenewly installed name.Login as each user to make sure the passwordfile is correctly edited.For example:.DSed /etc/passwd$ajoe::10:1::/usr/joe:.li.wqmkdir /usr/joechown joe /usr/joelogin joels \-lalogin root.DEThis will make a new login entry for joe.His default current directory is/usr/joewhich has been created.The delivered password filehas the user.Iken.Rin it to be used as a prototype..SHMultiple Users.PPIf UNIX is to support simultaneousaccess from more than just the console teletype,the file /etc/ttys (ttys-V) has to be edited.For some historical reason tty8 is the name of the console typewriter.To add new typewriters be sure the device is configuredand the special file exists, then setthe first character of the appropriate line of /etc/ttys to 1(or add a new line).Note that init.c will have to be recompiled if there are to bemore than 20 typewriters.Also note that if the special file is inaccessible when init tries to create a processfor it, the system will thrash trying and retrying to open it..SHFile System Health.PPPeriodically (say every day or so) and always after a crash,you should check all the file systems for consistency(icheck, dcheck-VIII).It is quite important to execute sync (VIII)before rebooting or taking the machine down.This is done automatically every 30 seconds by the updateprogram (VIII) when a multiple-user system is running,but you should do it anyway to make sure..PPDumping of the file system should be done regularly,since once the system is going it is very easy tobecome complacent.Just remember that our RP controller has failed three times,each time in such a way that all informationon the disk was wiped out without anyerror status from the controller.Complete and incremental dumps are easily done withthe dump command (VIII) but restoration of individualfiles is painful.Dumping of files by name is best done bytp (I) but the number of files is limited.Finally if there are enough drives entiredisks can be copied using cp-I, or preferably withdd-I using the raw special files and an appropriateblock size.Note that there is no stand-alone programwith UNIX that will restore any of these formats.Unless some action has been taken toprevent destruction of a running version ofUNIX, you can find yourself stranded even thoughyou have backup..bp.SHOdds and Ends.PPThe programsdump,icheck, dcheck, ncheck, and df(source in /usr/source/s1 and /usr/source/s2)should be changed toreflect your default mounted file system devices.Print the first few lines of theseprograms and the changes will be obvious..PPIf you would like to share any UNIX compatiblesoftware with others,please let us know about it.If you find bugs in the software or thedocumentation,again let us know..PPLastly,there is a UNIX users' group forming.To get on their mailing list,send your name(s) and address to:.DSProf. Melvin FerentzPhysics Dept.Brooklyn College of CUNYBrooklyn, N.Y. 11210.DE.PP.DS		Good luck.		Ken Thompson		Dennis Ritchie.DE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -