Eric Linux - 1 Basic concepts of linux


Computer basic

Computer 5 parts

  • CPU
  • Input
  • Output
  • Memory
  • External storage device.

    CPU

  • RISC: Reduced Instruction Set Computing, Each instruction is simple and efficient, but need multiple instructions when need to do a complex task.
    • SPARC series of Sun: mainly used in large workstation of academic field, and servers in financial field.
    • Power Architecture(Include PowerPC) of IBM: Sony's PS3 used this type cpu.
    • ARM: Our phone, PDA, switch and router devices ...
  • CISC: Complex instruction set computing. Each instrunction can do multiple simple tasks, so the instructions are many and complex.
    • CPU based on x86, x86_64 of AMD , Intel.

      Unit of computer

  • 1Byte = 8bit
  • B,K , M, G, T, P
  • 1GB file size = 1024 * 1024 * 1024 B
  • 1GHz = 1000 * 1000 * 1000 Hz, Hz means how many time in one second.
  • In network transmission, 8Mbit/8 is a transmission speed, it's actually 1MB/s in file size.
  • Hard disk uses decimal system , so if a hard disk is 500G, it actually is 500 * 1000 * 1000 B which approximately equal to 466GB.

    Interface devices

    Motherboard

  • North bridge : link CPU, memory,video card.
  • South bridge: hard disk, USB, network card.

    CPU

  • External Frequency : the transmission/computing speed between CPU and external components.
  • Multiplication Frequency : accelerate work speed in CPU internal.
  • CPU Frequency = External Frequency * Multiplication Frequency
  • North bridge bus is called System Bus, it's channel of memory. North bridge bus is I/O bus, it's channel of hard disk, USB,network disk, etc.
  • word size: the data quantity which CPU can handle once time.
  • Bus width: number of bits per transmission by north birdge bus.

    Memory

  • DRAM : Dynamic Random Access Memory
  • DDR SDRAM: Double data rate
  • Dual channel design: two same memories can provide more wide width.
  • CPU has a L2 Cache which is SRAM(Static Random Access Memory)
  • BIOS is a program which is hosted on ROM.

    Vidwo card

  • Video card is also called VGA(Video graphics array). It also has its memory and cpu(called GPU).
  • Vidwo card impacts screen resolution and color depth.
  • Specifications: PCI -> AGP-> PCI-Express

    Hard disk

  • Desktop usually use 3.5 inches hard disk, notebook use 2.5 inches.
  • Components:
    • Sector: each sector's physical size is 512bytes.
    • Track: A circular which is composed of sectors.
    • Cylinder: the same tracks of all the discs composes a cylinder. Cylinder is the minimum unit when we make partition disk.
  • Hard disk size = header * cylinders per header * sectors per cylinder * capacity per sector.
  • IDE Interface: each cable can connect two IDE device. The maximum transmission speed is 133MB
  • SATA Interface: each SATA cable can only connect one SATA device. Usually its transmission speed is 300 MB per second.
  • SCSI Interface: usually used in workstaion or larger computer. Its controller contains a cpu so its running speed is fast and its CPU consumption is low.
  • Hard disk has a buffer memory which used to cache frequently used data.
  • The speed usually is 7200 and 5400.

    Mainboard

  • North bridge is in charge of CPU/RAM/VGA
  • South bridge is in charge of PCI and I/O device.
  • I/O address and IRQ: IRQ is used to connect I/O address and CPU.
  • CMOS and BIOS: CMOS is used to record mainboard's data like system time, CPU voltage and frequency, I/O address and IRQ etc. BIOS is a program which run when boot.
  • Interface devices:
    • PS/2 interface: like mouse and keyboard.
    • USB interface.
    • Audio input/output and microphone, these are some circular hubs.
    • RJ-45 interface: like cable interface.
    • other legacy interface: nine serial interface(com1) which is used to connect to mouse, 25 parallel port(LPT1) which is used to connect printer.
  • Power: Usually have two specifications.20 pin and 24 pin.
    • Energy conversion rate: output power / input power.

      data presentation

      ### Binary

      Linux birth

      POSIX Specification

      Public Operating System Interface ,Both Linux and UNIX follow POSIX , so they can share lots of softwares POSIX define the interfaces standard between kernel and applications.

      Version

      2.6.18-e15 2 primary version, 6 secondary version, 18 release version, e15 modification version.
      2.5.xx : Odd number version, developing version, not stable.
      2.6.xx Even number version, stable .

      Linux distributions

  • RPM installation: Red Hat, Fedora, Suse. dpkg installation: Debian, Ubuntu, B2D.

  • Shareware: has expire date. After the date,you need pay for it if you want to continue use it.

    Device in linux

    Hardware's name in linux

  • IDE hard disk: /dev/hd[a-d]
  • SCSI/SATA/USB disk: /dev/sd[a-p]
  • soft driver: /dev/fd[0-1]
  • mouse: USB mouse: /dev/usb/mouse[0-15] PS2 mouse: /dev/psaux
  • printer: 25 pin: /dev/lp[0-2] , USB: /dev/usb/lp[0-15]
  • CD ROM/DVD ROM: /dev/cdrom
  • Tape drive: IDE: /dev/ht0 , SCSI: /dev/st0

    Disk partition

    IDE interface device:

  • Usually a computer has two IDE interface, each interface can connect two IDE device.
  • IDE1 (primary): /dev/hda (master), /dev/hdb (slave)
  • IDE2 (secondary): /dev/hdc (master), /dev/hdd (slave)
  • SATA disk's name is decided by the order detected by the kernel.

    Disk composition

  • Sector: each sector is 512 bytes.
  • The first sector of disk is most important, it contains 2 data:
    • MBR(Master Boot Record): 446 bytes, boot loader program is intalled here.
    • partition table: 64 bytes, contains all the partitions of the disk.
  • Partition table
    • Cylinder is the minimum unit of disk partition and file system.
    • 64 bytes is separated into 4 partitions: Primary and Extended partitions.
    • /dev/hda1 --- /dev/hda4 is retained for primary and extended partitions.
    • Extended partition can not be formatted. And can only have one ,this is OS limitted.
    • Logic disk is splitted from extended partition, IDE disk have 59 logic partitions at most (5-63), SATA disk has 11 logic partitions at most (5 - 15).
  • BIOS is the first program to run when start computer, it will find the appropriate disk and to start the boot loader in MBR. The boot loader then load the kernel .
  • Boot loader
    • Boot menus: multi boot functions.
    • load kernel.
    • Transfer to other boot loader.
    • Every partition has one boot sector and can have boot loader, so we can support multi boot system.

      How to choose disk partition (most important)

  • directory tree: all are files in linux, and they are managed via a tree structure. The most important directory is root directory: /.
  • mount: map partition to a specific directory, once you enter the dir, you can read the partition's data, so the dir is also called "mount point".
    Root dir must be mounted by a partition.
  • Usual partition: /boot, / , swap, /usr, /var, /home .

优质内容筛选与推荐>>
1、React Native 系列(三) -- 项目结构介绍
2、华为最懂任正非的人:一人之下、万人之上
3、算法入门
4、城市背影
5、Eclipse 导入项目乱码问题(中文乱码)


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号