C: 
  

  


   ?     ?        ?          .         ,  ,      ,   ,   .      -. ISBN 978-5-317-05877-7      . . , 2018  .   , 2018










, !

    ,              .  ,         . ,       Linux,   ,     . ,     ,      Linux  , ,   .       Linux,   .

      Linux    de-facto   .       ,  Windows, AIX  ,       .      ,           .            .   ,        ,   .  ,      .

    , ,   ,       . ,   ,       ,  ,   ,     .

        , , ,    .    ,   :  , ,     ,         .     ,    IT      :     ,     ,   - ,      .

          ,      ,    .        ,   ,    ,     , , .  -      ,         ,        ,       .

,       ,  ,       , ,        ,    .     ,       ,   ,         .  ,   ,      ,     (  )       .    , ,        ,      .           ,  ( )       .          ,    ,       .

 ,            ?     ?       ?      .      ,    pdsh,  

grep MemTotal /proc/meminfo | awk '{print $2}'

       .     shell,       (   )    ,   . ,  ?  -, ,       .

          .  ,       .       ,      Linux    !    Advanced Bash Scripting Guide (     ).       ,    ,  bash (     zsh).        sed  awk (    ,   perl,   , python  ruby),   find, ps   ,      .

               Linux,       ,         .           .   Linux     :      .    :    ,    Linux-.

      ,        ,   .  ,          ,     .        ,      .             .            .                  .




  ,   


 ,     :








,  ,    :

!      !

      .

     : ls -la.

  ,     ,  :

      .

       .    ,  -   .            .       ,     .      ,   ,    ,       ,      ,  ,  ,          .

   , ,    superbook@parallel.ru.

   :

     ,

         ,

 ,  ,        .

  (dikbsd)         .




 1.    ?





       


      .                 .         ,       simultaneous multithreading (, HyperThreading  Intel  AMD SMT),    ( )   .         .

    :       (..          ),      , .. .             .

       . ,  x=a+b  y=b*c,  a, b    ,    ,         (. .1).       .

     ,        ,        :   .  ,         .             , ..  ,     (. .2).






. 1:  






. 2:  + 



       .     .   ,   ,    ,        . ,    ,  , , ,   .                 ,       .            .  ,         ,      S ,    N    K*(N1)+S.

     S  (    ),          K .      K=1.        . ,           ,     .

         ,       ,   ,      ,  .    , ..    (  )     (  ). ,     .        ,       ,  ,     .                             /.      ,               .

 ,   .  ,    ,   (, ,  )  ,     ,      . ..   .      (  ,    ),         ,  ,   ,  .[1 -       :  ..    MPI  OpenMP: . . .: .. . .:   , 2012. 344 . (  ).]

    ,   ,        ()? .  ,     .  ,    ,       . ,              .            . 

    ,          , , ,    .     ,      軠 ,       ,       ,      .

          UNIX (     )  .       .          MPI  OpenMP.   ,       ,      .  ()        ,     .

   ,    ,    ,         ,    .       ,           .  ,  ,        (  ).               (   )    ,       .

               .        ,         : MPI   ,  OpenMP         ..   MPI           ,     .     ,    ,        (    )            (  ).       .       ,         .

,       (InfiniBand  )   Ethernet  .   MPI ,     .     ,    MPI      .




 


  ,   ,    .       .    ,  , .

    High-Availability,    .       -       .    web-,     .                           .       :   ,            ,     .

    High Productivity.     ,            ,   .  -  ,     ;      ,      ,     .      GRID,   Seti@home, Folding@Home.            .           ,      ,       .

   High Performance (HPC  High Performance Computing).    .    ,       ,  ,      ,             .  ,     , HPC-    ,           .

           .     ,  ,     ,     ,   ,    . ,    ,  ,         .      ,   ,            .

,      ,           .  ,      ,     𠖠 -    ,   .          ( ),         ().      ,  ,           .            ,   ,   .




      


     .       ? ,  .          . ..        ,   ,   .

        ,   .      Blue Gene  IBM       ,       ,     ,   Blue Gene    IBM   .

 Blue Gene  :     .     ,    .  Blue Gene    ,   .     , ..  ,    ,        ,    BeoWulf[2 -  . http://parallel.ru/computers/reviews/beowulf.html.], ..     .

 ,      -  ,     ,      .      :   .       ,     . ,        .    ,    ,       ,    .       ,   ,  ,           ,     ,    .  ,       .




     


  ,         ,   ,         ..     ,   .         .                     (,      , ),     .  IB-  GigabitEthernet    8     4,       ,      .

    ( )    ,      ,          .

   ,  ,     ,      (    ,   ).        ,        .      ,     ,   UPS    ,            .

            ,       .       (  )     .  ,    ,   ,   UPS   ,        ,    ,    .  ,       ,             .       .         .     .        .       :         ,          . 99%          .     ,      80100%    .

              .     ,      - 񻠖       ,       ,        ,   ,    ,              ,    .    蠖.      :   , - , - ,  ,             ,     ,       ,  .    , ,  ,   .                  ,  -  .

 :    (  )           -   ,     ,       .  :                  ,      ,       .

   ,    ,        . ,        ,      .          ,        .                .     ,     ,   .

      :         ,         , , ,       .      -              ,           , ,    /  ,    .




   



   ,         .    ,   ,    ,  ,    , ,     .       ,        .   ,     , ,         ,       ,   .

             . ,  ,       .              ,     ,  ,    , ,         .          HP OpenView  Zenoss.    !    .  ,        .    ,     ,      ,    (   ,   )      .

,  .  ,  ,   ,    ,   ,     .    ,    ,    ,  ,       , ,        ,     .         ,    ,   .  ,        ,        .                    .    ,        .  ,           ,   ,   ,               .

     .     ,   (    )        !




 


    -  ,           ,    .          ,      .  ,      ,     .




   


HPC, beowulf, supercomputer.




 2.   



   :     ?            .      뻠    ,   HPC  .

,       ,     .  ,     .          ,         ,     .        :

 ,       ;

 ,       ,    ..;

           ,    IPMI  iKVM,   (,  ,   ..) , , .

        .

       :  ,  .           ,   .  ,       ,         .




 


        .         .        (       ),  ,       ssh.          .




 


     .  ,     ,           .     ,    ,    .        ,   ,  (!)     .

       ,     ,       ,     , , ,         ,        ..      ,   .        ,       .  -    .       ,     ,     ( ,   ),     swap-    /tmp.      .

                .         :    ,  .

        ,   (     ), cron (      ssh    ), udev, acpid  ..    ,   udev,  ,              .        sshd     .      .      udev :      (systemd, ).     ,    .  ,        ( )     .       ,        .                ( ),          (, 1520 ).




 


 ,     , .       (, NFS-)   ,              .   ,    ,       ,     .

  .                . ,         ,          ,        ( ).

           (,    )        :     .            ,         .

       ,  ,    ,     ,    .       ,     ,       . ,     FlexLM    .             (    ),          .   MAC-  ,               MAC-.         , ,    MAC-.

              (   /,  . pre-  postprocessing).       ,     (256   ),      ?     .

      .                    .   ,  ,       (,       ).       /.

          .         ,                  (      ).

       :

  ;

  ;

  ;

   ;

  ;

     ;

       ;

   ;

  .

   ,        .




 


       .      :     .  ,  ,     . ,  ,    ,      ,          .

      .        :    .

  ,           (   ).        .   ,  ,    1,5?2   .   ()         .       ,            .

     ,       .        ,          ,          ,   ,    .               ,      :          .

            .       Ethernet,      ,      ,       ,    .






 1:    



 1           .              .     ,         1000$,       10000$  1000000$  .                 InfiniBand.            ,   .

        (   ). , GigabitEthernet    ,            TCP/IP,      ,  .

InfiniBand     ,    Subnet Manager.   Subnet Manager   , ,  , ,     .   ,   InfiniBand   ,        ,     .      .           . ,  GigabitEthernet-,   ,    .      ,     ,      .       ,   ,  EtherChannel, bonding, trunking.   ,   ,    ,    (, bonding    -   ).




InfiniBand



       InfiniBand,  ,   ,         ,    HPC-        ,    , InfiniBand         Ethernet,       .     InfiniBand ,    ,      .

 InfiniBand   InfiniBand Trade Association, InfiniBand    ,     .      c    OFED (OpenFabrics Enterprise Distribution),         ,    InfiniBand (,   ). -  InfiniBand        .       OFED   ,       .

 (link)   InfiniBand     (lanes),  .        .     4x ( ,  ).  12x     ,    ,    .          InfiniBand.         ,   (  )   ,     .         2.

    InfiniBand     (raw speed)  , ..  ,        .              .   SDR-QDR 8     10,   ,   FDR-EDR   64/66.          ,    .






 2:   InfiniBand



  ,    InfiniBand ( ,     InfiniBand    , Processor Node,     ..),     InfiniBand (HCA, Host Channel Adapter).     HCA,  TCA (Target Channel Adapter),        ,       .

     (ports)    .  InfiniBand (    InfiniBand, InfiniBand Fabric)   ,      (switches)   (routers).        .       0,     .

,      ,   (endports).  ,    ,   (subnet).      ,     ,   215+2141=49151    .     ,    InfiniBand   .




      InfiniBand


  InfiniBand  ,   GUID (Globally Unique ID,   ),   64 .     ,     . GUID   ,       .    NodeGUID    PortGUID    .   PortGUID    NodeGUID .    NodeGUID  PortGUID,   PortGUID       .

  ,  SystemImage GUID.      ,      (    ).   , ,       ,     .  ,    ,    ,         (,  -  firmware). SystemImage GUID    NodeGUID   ,   ,   ,         (         ).

GUID      InfiniBand,    ,      .        .          LID (Local ID,  ).          GID (Global ID,  ). GID         ,     GID         GRH (Global Routing Header,   ),        .

  LID    16 .  LID=0      ; LID  1  0xBFFF    LID,    - (unicast): LID  0xC000  0xFFFE      (multicast); LID=0xFFFF     LID (permissive LID), ,   LID,    ,  .       (LID    ,     )          LID,      LID   .

   LID        .    LID    ,       :      (forwarding table)      LID.    ,           ,       LID.      LID (Base LID)  LMC (LID Mask Control,   LID). LMC     0  128.

 LMC   LID    ,  ,    2LMC    LID, ..   BaseLID  BaseLID+ 2LMC1.       LID,  LMC=0.          LMC:    LID     (  )   LID .

  GID    128 .     . , GID    IPv6,    64    GUID ,    GID.  64  GID (GID Prefix,  GID)    0xFE80::/64 (       IPv6 . RFC2373).       (link-local scope).    GID ,   ,      , .. GID           .        (  )  GID,     .   GID          GID .

 0xFEC0::/64       (site-local scope).  ,   ,       ,       (     ).          (global scope),     ,    IPv6.   (unicast) GID   GID,    (multicast)  .   GID    0xFF,          RFC2373  RFC2375.

    LID  GID     ,      (Directed Route).         (Subnet Management Packet, SMP).        ,      LID      ,      ,       LID  .             ,       (Initial Path).        (hop count),       ,        (hop pointer),   D (Direction, 0        , 1            )    (reverse path).

    D=0,        Hop Pointer  ,      ,   ,    ,       Reverse Path,    hop pointer  .   ,    ,  ,      (  D  1)   .   ,       ,         ,      ,       hop pointer  .

     ,   LID ,           ( LID),  LID ,       ,    ,   . ,         ,   ,          LID.




  InfiniBand


   ,     InfiniBand   :  LID    ,     (    Ethernet,   InfiniBand       ,    ).

,     ,        ,    (Subnet Manager).     ,        InfiniBand    (   InfiniBand    ).         ,         (master),     (standby).  ,     ,        .            , ,    .

        ,    ,   :   , , ,      .      ,  ,        ,        , ..     LID,     LID ,      ,         .      .               (   Sweeping)     .

      ,       ,        ,      .




IP  InfiniBand (IP over IB, IPoIB)


   TCP/IP  InfiniBand     InfiniBand,      RFC.  InfiniBand     IPoIB.            InfiniBand,    IP  InfiniBand.     IpoIB  InfiniBand- (LID, GID) ,     ,          TCP/IP.

 IP  InfiniBand,  ,     IP  Ethernet.    ,     .  IPoIB    ib0, ib1  .. (     InfiniBand).    ,         .   DHCP  IPoIB ,        .

   (link layer address),    Ethernet  MAC-  hardware address,  IPoIB    20.   ,  ,    ifconfig,      MAC- Ethernet  6,           IPoIB.  ip,    ifconfig,   .      GID ,    (Queue Pair Number, QPN,     TCP  InfiniBand)  , ,     InfiniBand     IP.




      InfiniBand


           OFED    .      ,     InfiniBand,       .

 ibstat        InfiniBand,   ,   








    :   (mlx5_0),   ( ),  ,    (firmware)   ,    Node GUID  System Image GUID.

     Link layer   : InfiiniBand  Ethernet.   InfiniBand      InfiniBand,    Ethernet.     .  Port GUID  GUID . Base lid   LID,   .   ,   , 2LMC   LID. SM lid  LID ,      . Rate    ,     (56       4xFDR).

Physical state      .    LinkUp.    Disabled, Polling (      ), Configuration (      ), Recovery (   ).    ,         ,       .

State      . Active  ,     . Down     (       LinkUp). Initialize  ,        ,       LinkUp.            (SMP, Subnet Management Packets).         ( LID   )      Active.    ,         ,     .

Capability mask   ,      (  ..).

 ibstatus      ,     ,      :








 ,     LID  LID      .      ,    .    default gid,    GID   .

  ,     LID.      smpquery.          SMP (Subnet Management Packet)       .         (node description).     smpquerynodedesc914 (    LID 914):








 ,  LID 914   HCA-1     n51001.

  smpquery     ,   .            .          saquery.      LID 914    saquery914.     :








     ,   .    .    ,   smpdump        InfiniBand    ,   saquery    .         saquery     ,      .        InfiniBand   ibnetdiscover  ibdiagnet.  ibnetdiscover     :  , ,     ,       .  ibdiagnet      ,            ,    GUID,    ..

       ,     ,   ibdiagnet      .    ,   ,          InfiniBand.

,     ,       ,     (,         LID     ).  -C     (, mlx4_0   ),   -P       ( ,   1).




 


    ,          .        ,         .

        ,    ( )     . ,        ,         ,               .        ,       .

     (  )      ,      ,     ,     (    )   ,       .           ,            .        ,     .

         :

     Direct Attached Storage  DAS;

            Network Attached Storage,  NAS;

 ,       Storage Area Network  SAN (..3).

         ,    .        ,    ,      (    SATA, SAS, Fibre Channel).






. 3:    (SAN)



             RAID (redundant array of independent disks     ).   RAID         .      (       ).           .

  ,     de-facto  RAID:

RAID-0       ,    : 0=0  , 1=1    ..;

RAID-1   ,   N    N  ,     ;

RAID-2       ;

RAID-3  -4          ;

RAID-5          ;

RAID-6     ,    ,    .

 0            ,    ;  1   ,      N-1      .

 2, 3  4    ,    5          .        ,   (.stripe).

          (  6   ),     ,   ,    ,         .            ,      .       ,     ,    ,               .

 ,  RAID-5      ,    (RAID-1),              (  RAID-6).  ,    3-5 .               ,     .

     RAID-       RAID-.     RAID   :   ,  .    RAID-10 (RAID-0,    RAID-1), RAID-50  -60   RAID-0,    RAID-5  -6 .   RAID     .

    , ,   Lustre (    ),       ,  ,    ,     .       (   , NAS)        ,         .       NFS (Network File System), Server Message Block (SMB)      Common Internet File System (CIFS).

 , CIFS  SMB           ,    IBM        Microsoft.  CIFS               .  ,  NFS  CIFS  NAS          ,  FTP, HTTP  iSCSI.

,       (SAN),          .  SAN  ,             .             ,     , 堖 .       ,     ,      .

      ,    ,   -   .     ,     (multipath)    . ,    multipath   ,       ,      multipath       .

 NAS  SAN  ,     iSCSI,          .                .         . ,   SAN-   InfiniBand,         .




  



    ,           (     )  . ,      ,      .       ,          .        ,  ,  ,      (,  ).

            (    ).          ,  SMP- ( . Symmetric Multiprocessor System) (..4).






. 4:    (SMP)



   ,  ,     ,     .          ,    .          (  2  16).           SMP-. ,     SMP-,        (  ,        ).

        NUMA  Non-Uniform Memory Access.          ,        ,       .       ,   黠  .           .






. 5:   NUMA   AMD Magny-Cours



,   AMD Magny-Cours (. .5)       ( ),     HyperTransport.   ()            .        ,      HyperTransport.  ,  SMP-  NUMA-       ,         .

           .                 (  ),       .

  ,     ,  ,      ,      .   ,      ,   .     SMP-         ,   NUMA-           .

 ,         ,      (processor affinity,  pinning).       ,            NUMA-. Ѡ        ,    .

         . , ,    NUMA-,      .        ?        NUMA-,     ?  ,       ,        NUMA- (memory affinity).

          NUMA-   ,    .                .         ,  .            (#litres_trial_promo),      .

     Intel   HyperThreading.             . ,           ,             .         ,      HyperThreading   ,   ,      .

         BIOS  ,         .  ,        .        ,        HyperThreading    .     ,         ,    HT.        ,      .

       ,   .    ,         .            ,     .           (Direct Memory Access,  DMA),          . ,                DMA.

 InfiniBand,   DMA,              ( Remote Direct Memory Access,  RDMA).         (      ).   RDMA         .

     . ,    - (two-sided Send/Receive model),     Cray (  SeaStar)     Quadrics QsNet, Qlogic InfiniPath  Myrinet Express,        MPI. ,       RDMA,    .      RDMA   ,     ( )       .




 


 ,     ,           .        ,     .




   


rdma, hpc interconnect, numa, smp, cache, latency.




 3.   



  ,      . ,       ,   ,      ,   ..,      .

            .       ( , batch system).   ,     :       MPI, Cuda  ..

      ,     ,   BLAS, FFT  .            , ,  ,   .




    


        ,        .     .

,        , ,   ..      ssh- (putty, openssh  ..),  , ,        (  ,     )     .    ,        ,    sftp  .       ,      .       , ,     ,       .      ,     .   ,    ,          ,     .

         (,       ).       ,  /    ,           /  ,   .         ,   /   .          ,       .

     ,        Linux ( ,    ).   Linux            .        Midnight Commander (mc),     .




  


      .      .         ,     ,    MPI-,  ,     ..             mpirun ( MPI-),     ..

    ,     ,  .           -     ,   (,  )   ,     ,  , ,    (  )     .

      ,    :        ,  mpirun,       .            ( ssh)      .       ,   .        ,   ,      .            (    ),     .

           ,     ,         ..      ,   .       . -         ,           .

       ,    ,      , ,    ,     .




   



,    ,  ,    .    ,      ,      .   ,     :   ,   , ,    ,    ,    ,    ,  .       ,     .




 


       :   ,    ,     ssh,      NFS-,      NFS  ,   ,   MPI-.      ,          :     , NFS ,   ,    ,   ,   . ,    ,     ,         .        ,     .




 


MPI,  , ssh-, NFS.




 4. UNIX  Linux  



    Linux       ,     .         ,        ,      bash.

          ,     ,    :



 ,  ,  ,  

Unix  Linux:   


    Unix  Linux.         ,  VAX  PDP-11,         UNIX      .



 ,  ,  

   .  


    Linux,    .



 ,  

Unix   


          bash,      .        ,     ,       ,      UNIX,      ,   .



 

-   


    .     ,      ,   ,       .

        UNIX,         ,       .           UNIX-  .   UNIX-,     UNIX          .



  .    AT&T,     ,   UNIX         ,  ,      Novell.  1993. Novell                X/Open,     Open Software Foundation    The Open Group.        ,   POSIX (    Single UNIX Specification).

  The Open Group,  UNIX    ,     Single UNIX Specification.          ,  Solaris, AIX.


  ,     UNIX ( Linux),    .         ,         ,           .       UNIX  ,         Solaris, OpenBSD, FreeBSD, AIX ,  , Linux   UNIX-      .

     .   de facto  Linux.         .           ,   Windows, FreeBSD, Solaris  ,             HPC.







      .     (     ),    (PID),  (,    ),  ,  , ,   ,      .        ,     ,    ,      (      ),    .    R(running), S(sleeping), D(uninterruptable sleep), T(stopped)  Z(zombie).

,      2  10    ,      2,       ( 100   )    ,             ( ,    ).          ,       5 ,   .

        軠 Load Average.     ,    ,      ,    .           D,    LA   , , ,       (     read  write).    LA  ,   -  ,    .

  stopped  ,        STOP.          ,     CONT (   ).     D,   .  ,  STOP   ,     .

 zombie ,   ,       (    wait).    ,        ,   . ..    zombie       ,  .            .

  (PPID)      ,    ,      PID 1 (    init  ,     ),   wait    .

          ps.    , ..     (Unix, BSD, Solaris)      ,     .    Linux   GNU,    .  ,  ,       ,       .       :








     w,     (   )  .   ,    ,   ,       .

       .    top    htop.      ,    ,      5  (  ).      ,    ,      堖  , , loadaverage,     .

     .  top    ,    ,  'h'.      :

<Shift>+<P>    ;

<Shift>+<M>    ;

1       ;

k    ;

r    ;

u    ;

q  .

 htop   ,      ,         -,      (     ,    ).         Norton Commander (Midnight Commander/FAR manager).

           ,      ,       ( root   ).    ,       ,        - .  ,  KILL,     ,     ,        .

       ,     :






3:    Linux



      (  KILL).     .          .. core-  ,        .    core-,      (.   ).

       kill. , kill -9 1234    1234,  kill -STOP 2345   2345.  ,     ,    . kill -l    .       ,  ,    .      pkill: pkill -u vasya -TERM   TERM    vasya.

    ,  ,  ,   .       ,          nice ().   ,       .    ,     (      ,     ).    nice  renice,      ,     .   ,   ,      .     20  +20,         0. :








     0  15 ( )   -10 ( ).

          ,     -,     .      ,    ionice.      idle ( ,      ), best effort ( )  real time (      ).  ,  idle,   ,         idle ,      ,   :








      .      ,  ,       ,     (shared objects, so)    (ld.so).               .







Unix-      ,  ,           .         , , ,       (     ).            .

     UNIX-     UID,  UserID ( )  GID,  GroupID ( ,   ). UID  GID  ,       .     UID  GID (ruid/rgid),     ,     ,    .  ,    UID  GID (euid/egid),      (..      ),    UID  GID (suid/sgid)      UID/GID   UID/GID.  UID/GID  ,       (capability)   EUID  SUID  0.

  UID=0     'root'    ,     .

 , ,       .    (, , , , , ,      )    ,        ,   .           ls. ,     750 (  ls rwxr-x) ,    ,    (rwx/7),      (r-x/5),    (-/0).

            EUID,   . ,           ,    ,       .

         .                .           .     (  )    .      ,      .   ,     ,       .

   ,           .    .       ,  /tmp,      ,      (sticky).    ,      ,          ( root-, ).

     ,        suid  sgid.     suid,     EUID     .  sgid  ,   .      ,      ,  passwd.     .   sgid   ,          .  suid   .

   ,     ls.         ('-'=, 'd'=, 'l'=, 's'=  ..),     ,       'r/-', 'w/-' 'x/-'  ,     ('-'   ).  sticky   't'  'x'  .  suid/sgid   's'  'x'     .       '+',  ,      acl (. ).

      chmod.      chown,   chgrp.  ,     ,  chmod         .          ,   , :








    chmod      'u/g/o/a' (, , ,    ),   '+'  '-'     ,       'r/w/x'   . , chmodgo+rxmyfile            myfile.

     ,   .        ,     Linux.       .    ,        lsattr  chattr.    :






4:   



    -  ( ),       (    ).          .

 ,       , ACL (Access Control List),   .       getfacl  setfacl.      ,  ,    //      / ,      .        acl (    ),   . ,   vasya       test.txt:








  '-m'    acl.   '--set',   , ..      ( setfacl     ).  '-x'   .  'u:vasya;rw'   ,      (u=user, g=group, o=others),  < vasya,       .       vasya ( ,     acl)    :








 ,  ,      .

    acl   .     acl  ,      acl   ,           .

      Linux    ,      .




 ,  


       , , .       :    ,        .        ,  ,    . , web- apache  ,    http-. SMTP-         ..  ,    .             .

     inetd       xinetd.       inetd/xinetd   :  ,    ,       ..   inetd/xinetd            ,         .     ,          . , xinetd    ,    ,        ..

 ,    ,  ,     (  ,   inetd/xinetd),   -    (    )  netstat -lpn.

 (  )   :






5:      



       /etc/services         .           , , ,     -    ,    .   inetd/xinetd    ,  tftp, echo,ftp.







  UNIX   ,           .           .           .   ,       .

  ,   , man. Ÿ        (man),   ,  (manual).        ,      UNIX  Linux.    man   ,    .  ,     -    man _. Man         .






6:   man



          ,       . ,   man crontab     crontab   1.       crontab,   man 5 crontab,   ,       man -k .  ,    man man.

 man,    info,     man, ,     ,     .          info  ,   man.




   


        ,  '/'  '\0'.        UNIX    shell.  shell      (  )      .     shell:






7:  shell



UNIX        ,        '\'       ''.




  


       ; ,  'text.cc'   '.cc'.        ,       .      :






8:   



 ,            .     '.exe'  '.sh',     .      'do_it_now'   ,  'chmod a+x do_it_now'.      ,  ,  .

,    (.),      .            . ,  ls   ,     '-a'.

         .        shell.   .







  (shell)  UNIX           ,    .       . ,   'ls *.c',        '.c'  .

 ,  '*.c'   ,    shell   .        1.c  2.,     'ls 1.c 2.c'.          ,      (..    'ls *.c').






9:   shell



 ,  '{}',           ,    .    '{}'     .

, 'ls*.{cxx,h,la}'   ls *.cxx *.h *.la.     'cp config{,.bak}',    cp config config.bak.    ,    .

    '*', '?'  '[]',        ,      . ,   ,       'ls *.abc',    'ls *.abc', ..        .        ,   ,                !

   ,        '\'       . ,        --rf *.?,    :

rm  rf\ \*.\?



rm  'rf *.?'

     '--'      Linux     ,    .      , ,  ,       '-f',   'rm -f'  ,   '-f'    rm.   'rm  -f'.




     


pwd      .

cd [ dirname ]      (  ,  dirname  ); dirname    ,          .    ,      /,  ,      .

    :

d /export/home/user1       user1;

cd /       ;

cd prog/cc        cc,    prog;

cd ../gosha/bin          bin  gosha;

cd      .

  :

. ()   ;

.. ( )       .

 bash  zsh   ,  shell    :

~ ()   ;

~name     name;

()      (   cd).




    


mkdir [] _     .

:

-m mode    ;

-p      .

rmdir _     (   ).

ls [/]       .

ࠖ    .    ,     .

   :

-a   (     );

-l       ( ,    ,     512 ,   ,    );

-t     ,     ;

-R    ,    .




    


touch [] _   ,    ,      .

rm [] _    



-i  (  );

-f  ;

-r     .

:








      ,      . 

rm test*    ,   test;

rm test*( test  )      (   ).

mv []       .

:

-i  (  );

-f  .

 mv        .

1)    ,      ,  :

mv file1 file2    file1   file2;

mv dir1 dir2 dir2     ,   dir1   dir2;  dir2 ,   dir1    .

2)             :

mv file1 dir2   file1      dir2    ;

mv file1 dir2/file2   file1      dir2   file2.

    ,  젖,    :

mv file* ../dir2    ,      file,      .

   ,    , :    .

cp []       .

:

-i  (  ,      );

-f  ;

-r     ;

-p     ( ,  ).

:

cp file1 file2      file1     file2;

cp file1 dir2      file1   dir2 (..  dir2/file1);

cp -r dir1 dir2      dir1   dir2;

cp file1 file2 file3 /tmp      file1, file2, file3   tmp  .    :








 cat         .    ,   cat         ().        (),           .       .

cat ls.txt       ls.txt  ;

cat ls1.txt ls2.txt ls3.txt         ls1.txt, ls2.txt, ls3.txt;

cat ls1.txt ls2.txt ls3.txt > lsall.txt      .     .   lsall.txt  ,     .     ,      >> (  ).

 cat     :

cat > ls.txt          ls.txt.      Ctrl-D.

 cat     .   ,         .

        :

 more file.txt

 less file.txt

 less         ,     :






10:    less



tail []     .    10  .         .

:

-n number    ;

-r number     ;

-f        .

    Ctrl-.

grep []  [][]      .

:

-i     ;

-n    ,  ;

-v   ,   .

find []            ,   , ,  ,  .

:

-name filename    filename.   ,        'test*'     test\*;

-size [+|-]number    ,   (+)   (?).      512 ;

-atime number ,     number  ;

-mtime number ,    number  ;

-exec command \{\} \;  command   ,   find.   {}     ,  ';'   .      ,    , :








   core-,    .

 ,                        Midnight Commander.     ,     :








        ,     ,   (  ), , ,    ,   .      Midnight Commander    .      mcedit.

     .    ,    ,     .         ,          , ,  ,       .    ,  gnu nano. ,   ,    , ,      99% Linux-,   vi.

          ,         .                (,   ..).          .      .       ,     ,  'h,j,k,l' (    ,    ).  w  b      .  ,      : ':wq'   'ZZ' ( ).      ':q!'.

 :






11:    vi



       .      <ESC>.      ,       . , '10dd'  10  (     ,          'p').        ,   'cwNEW_WORD<ESC>'        'NEW_WORD',            '.',       'NEW_WORD'.

        's'. Ÿ     sed.        ,     ,   '.'   , $  ,   +   ,      .

,   old-cluster  new-supercomputer  10     , :








 ,   .     vi      .  ,      ,    ,  ,              ,    .







  Linux-   (  )        .     ,   rpm (RedHat, Fedora, CentOS, SuSE  ), deb (Debian, Ubuntu, Mint  ), ports (Arch Linux  ), ebuild (Gentoo  ), pkg (Slackware  ).         ,  web-,   ,   ,    (   ).      ,    ,    .       ,     .

       :

     ,     .      ( smtp-),      ;

 - ;

 ,    .

       ,   ,     .            ,   yum (RedHat), apt  aptitude (Debian), pacman (Arch Linux)  ..

  deb    :     (    )  ,       aptitude       ,  .    rpm         ,      

 -   ,    ,    -   (,   ,    ),         .

              ,     .     aptitude       ,   ,     .    ,  ,          .       ,     .          ,   ,     .          ,   100%,      .

        -,           .  CD/DVD-         ,       .           ( ).          . ,    RedHat      ,      ,  EPEL.      -    .        ,       .

     yum   :






12:      yum



       rpm-,      rpm. Ÿ  :






13:    rpm






 


        ,         .     .

 ping          ,      TCP/IP.       Echo-Request   ICMP    .        ,            ,        .

 :








:








  :








      ping  UNIX-    ,    .      ,    ,       .        icmp_seq,  ttl  Time To Live      ,    .      ,      .

 ,    ,   ttl  ;      ,            .         .    ping   ,    Ctrl-C,    ping   :    ,  ,   ,     .  ,  ,      .

   ping:

-c count      count;

-n   IP-     DNS-.            DNS   ;

-i interval       ;

-l size   .

          InfiniBand,    InfiniBand   IPoIB (IP over InfiniBand).   ,      ,  ,    .     traceroute      tracepath.       .

   ping      ttl,  1,  2  ..    ,          ttl    .  ,     .

   traceroute:








,  10-     ;  ,     ,     .

   traceroute:

-n   DNS- ,

-f N   TTL   ,

-m N  TTL   (  30),

-w N    (  5 .).

 route    , .. ,    ,   .   :








 :

 Destination   ;

 Gateway  (),    ;

 Genmask  (destination);

 Flags, Metric, Ref, Use  ;

 Iface  ,    .

        x.y.z.q,       :      destination    (genmask),    ,       (gateway)    (interface).      AND, ..  ,     0,      0,  ,     1,     ,     .

,  , ,   0.0.0.0  ,   ,        0.0.0.0.     default ( ).     9.10.11.*   eth1,  10.*.*.*    eth0 (  ),        9.10.11.1,     eth1.

 route      .      :








      1.2.3.*   eth0:








     








  ,   (gw)    .      'add'  'del',    .  ,        : netmask, gw, dev  ..,    ,     .

 ifconfig    .       :








   MAC-  (HWaddr), IP-  (inet addr),       (Bcast, Mask),   :

RX/TX packets  / ;

RX/TX bytes  / ;

UP BROADCAST RUNNING MULTICAST   ;

MTU    Ethernet;

txqueuelen    ;

errors   ;

dropped    ;

overruns    ;

frame      ;

carrier    ;

collisions     .

    ,      ,  ifconfig   -a.   root  ifconfig    .    eth0   ifconfigeth0down,    ifconfigeth0up.       :








     eth0  192.168.0.1   255.255.255.0.     ()   ifconfig eth0 up.     ifconfig    .

   Linux  route  ifconfig  ,       ip   iproute2.     ,       .

  ip :








        ,      . ໠ ,    .     , ,      ipv4     .




  .


   .

   ,     (https://www.litres.ru/konstantin-sergeevich-stefanov/cuperkomputery-administrirovanie/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .



notes








1


      :  ..    MPI  OpenMP: . . .: .. . .:   , 2012. 344 . (  ).




2


 . http://parallel.ru/computers/reviews/beowulf.html.


