Process

Process : A program in execution

  • A process includes
    • text section (program code itself)
    • stack/data/heap
    • prgram counter (PC)
    • CPU register contents
    • PCB(Process Control Block)
  • An instance of a program that is loaded into memory and running (independent object)

  • A unit of work in which system resources are allocated from the operating system.
    • That is, as a dynamic concept, it means an executed program.
    • Examples of allocated system resources
      • CPU time
      • Address space required to operate
      • Independent memory area in the structure of Code, Data, Stack, and Heap
  • Each process is allocated an independent memory area (structure of Code, Data, Stack, and Heap).
  • By default, each process has at least one thread (the main thread).
  • Each process runs in a separate address space, and one process cannot access the variables or data structures of another process.
  • In order for one process to access the resources of another process, inter-process communication (IPC) must be used.
    • Ex. Using communication methods using pipes, files, sockets, etc.

Thread

Thread : A unit of multiple flows running within a process.

  • Threads are allocated a separate stack within each process, and the code, data, and heap areas are shared.
  • A thread is a flow of execution that operates within one process, and is executed while sharing the address space or resources (heap space, etc.) within the process among the threads within the same process.
  • Multiple threads in the same process share the same heap space. On the other hand, a process cannot directly access the memory of another process.
  • Each thread has its own registers and stack, but the heap memory can be read from and written to each other.
  • When one thread changes a process resource, other sibling threads can see the change immediately.

shell script

shell script

To put it simply, a shell script expresses the each of the commands in the command line in Linux as a kind of file, and when the file is executed, it gives the effect that the commands were executed at just one command line.

Shell script characteristics

  • It is not compiled but interpreted by the operating system.
  • There are many types of shell scripts. (sh, dash, bash, rbash) What we’re going to cover in this post is bash scripts.
  • bash : rebuilt the existing basic shell
    • It is currently most widely used in linux-based operating systems.
    • When writing a bash script #! /bin/bash You can see that it starts like this, and it means the type of shell script.

Loop

  • example
#!/bin/bash

while [ $n -le 10 ] # (( $n <= 10 ))
do
    echo $n
    (( n++ )) #$(( n+1 ))
done

Example in steps

Edit mode after creating a shell file

  • vi [shell file name]
$ vi atest_100

atest_100

  • line 1 : #!/bin/bash
#!/bin/sh

int=0
while test "$int" -lt "100"

do
  a module --force
  int=`expr $int + 1`
done

Grant permission to execute shell file

  • ls -al : -rw-r–r– –> -rwxr-xr-x
$ chmod 755 atest_100

Execute Shell script

- ./ atest_100
- sh atest_100
- bash atest_100
- run test 100 times
$ sh atest_100

MSA

  • Existing system
    • Install APPlication (program) on top of system (infrastructure)
    • MONOLIX : ONE SINGLE APPLICATION / SYSTEM
  • MSA: Split by function
    • micro
    • Why..? splitting ??
      • What’s better…?
      • Communication between splitted systems is possible
      • Increased complexity
      • ex 1) A failure occurred in Netflix: All services were down
        • Advantages 1 > Let’s prevent the entire site from failing at the same time!
        • stop some of the services among whole system
      • ex 2) Running multiple services in one application
        • service 1 : inquiry
        • service 2 : payment
        • service 3 : settlement
        • Advantage 2 > If, among the services, “inquiry” service occupies 90% of API calls among all functions
          • In this case, MSA is introduced from the perspective of infrastructure efficiency
          • Introduction of Auto-scale function
        • Advantage 3 > When frequent update / distribution is required
          • Only some services update / distribute only the function
  • ROI : Need to consider Return of Investment

Docker

Each service split in MSA is managed as individual IMAGE through Docker
In Docker, each service is managed as a separate image, not as a VM

  • Docker: very easy to scale compared to VM

DevOps

Each service divided in MSA can be divided into tasks such as function development / operation infrastructure management
DevOps: Development + Operations

SRE (Site Reliability Engineering)

SRE: Technology to operate a stable site

Point

Manage large-capacity services based on Service Docker while taking them to the MSA structure
MSA functional unit managed / developed by DevOps team
The goal of DevOps is to operate a site with stable / trust considering SRE