https://cs50.harvard.edu/college/psets/1/

1. Hello

1
2
3
4
5
6
7
8
#include <stdio.h>
#include <cs50.h>
 
int main(void)
{
    string name = get_string("What is your name?\n");
    printf("hello, %s\n", name);
}
 

2a. Mario less

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <cs50.h>
#include <stdio.h>
 
int main(void)
{
    int stairs = get_int("Height: ");
    while(!(stairs >= 1 && stairs <= 8)) stairs = get_int("Height: ");
    for(int i = 0; i < stairs; i++){
        for(int j = stairs; j > i + 1; j--){
            printf(" ");
        }
        
        for(int j = 0; j <= i; j++){
            printf("#");
        }
        printf("\n");
    }
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

2b. Mario more

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <cs50.h>
#include <stdio.h>
 
int main(void)
{
    int stairs = get_int("Height: ");
    while(!(stairs >= 1 && stairs <= 8)) stairs = get_int("Height: ");
    
    for(int i = 0; i < stairs; i++){
        for(int j = stairs; j > i + 1; j--){
            printf(" ");
        }
        
        for(int j = 0; j < i + 1; j++){
            printf("#");
        }
        
        printf("  ");
        
        for(int j = 0; j < i + 1; j++){
            printf("#");
        }
        
        /*for(int j = stairs; j > i + 1; j--){
            printf(" ");
        }*/
        
        printf("\n");
    }
}
 
 

3a. Cash

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <math.h>
#include <cs50.h>
 
int main(void){
    float change = get_float("Change owed: ");
    while(!(change >= 0.00)) change = get_float("Change owed: ");
    
    int coins = round(change * 100);
    
    int count = 0;
    while(coins != 0){
        if(coins >= 25){
            int temp = coins/25;
            coins = coins - (temp * 25);
            count += temp;
        }
        if(coins >= 10){
            int temp = coins/10;
            coins = coins - (temp * 10);
            count += temp;
        }
        if(coins >= 5){
            int temp = coins/5;
            coins = coins - (temp * 5);
            count += temp;
        }
        count += coins;
        coins = 0;
    }
    
    printf("%i\n", count);
}
 
 
 

3b. Credit

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <cs50.h>
#include <stdio.h>
 
int main(void){
    long number = get_long("Number: ");
    char *answer = NULL;
    
    if((number/1000000000000 > 1 && (number/1000000000000) % 10 == 4||
      (number/1000000000000000 > 1 && (number/1000000000000000) % 10 == 4)) {
        
        answer = malloc(5 * sizeof(char));
        answer = "VISA";
    }
    else if((number/100000000000000> 1 && 
            ((number/10000000000000) % 100 == 34 || (number/10000000000000) % 100 == 37)){
       
        answer = malloc(5 * sizeof(char));
        answer = "AMEX";
    } 
    else if((number/100000000000000> 1 && 
            ((number/100000000000000) % 100 >= 51 && (number/100000000000000) % 100 <= 55)) {
        
        answer = malloc(10 * sizeof(char));
        answer = "MASTERCARD";
        printf("master?\n");
    } else {
        printf("INVALID\n");
        return 0;
    }
    
    int forSum = 0;
    for(long i = 10; i <= number; i *= 100){
        int divNum = ((number % (i * 10))/i) * 2;
        if(divNum >= 10){
            int temp = divNum % 10;
            divNum /= 10;
            forSum += temp + divNum;
        } else {
            forSum += divNum;
        }
        //printf("%i, %ld forSum, %i\n", forSum, i, divNum);
    }
    
    int restSum = 0;
    for(long i = 10; i <= number * 10; i *= 100){
        int restNum = (number % (i))/(i/10);
        restSum += restNum;
        //printf("%i, %ld restSum, %i\n", restSum, i, restNum);
    }
    if((forSum + restSum) % 10 == 0){
        printf("%s\n", answer);
    } else {
        printf("INVALID\n");
    }
    
}
 
 

'ETC' 카테고리의 다른 글

Algorithms(week3, problemset)  (0) 2020.01.06
Arrays(week 2, problem set)  (0) 2019.12.30
Memory (week3)  (0) 2019.12.27
Arrays and Sorting Algorithms (week2)  (0) 2019.12.26
C Programming Language(week 1)  (0) 2019.12.25

Compiling contains four steps, preprocessing, compiling, assembling and linking.

First convert a source code into required functions, like for instance in c, read hashtags and copy and past files.

Second step is compiling, convert source code into assembling codes.

Third step is assembling, converting assembling codes into machine codes, 1s and 0s.

Last, link all files into 0s and 1s.

 

Programmers don’t like to be tedious all the times, instead use powerful tools to assist them when programming. From cs50 sandbox, we will now use cs50 ide(integrated development environment)

 

 

Terminal commands

Ls – shows list of files in current location

Cd – redirect current location(cd .. for back, cd filename to go to that directory)

Rm – to remove a file

Mkdir – makes folder

Rmdir – removes directory

Make – creates a runnable code

./ - runs the source code

Touch – creates a file

 

 

Utilize the power of a debugger! Will save you minutes and hours with a problem.

String is actually an array of characters with null at the back.


0x0 is null! Could be seen at debugger

Data type can only receive certain size of a byte. String returns memory location.

 

brian returns 100th value in memory while veronica returns 900th value in memory.

 

String is a synonym of char *. * means an address of a something to its left, char * will mean character’s address. A pointer is an address.

 

When nothing is specified in the main function, it automatically returns 0 if it runs successfully.

 

Segmentation fault means user touched memory that user should not have. Returning one if null like above helps to prevent memory problems.

 

Difference in size of Char:

 

Since C only supports ASCII (English), 1 byte is enough for char (256 characters; 0 to 255). Since Java supports more than 18 international languages with over 3200 characters, a char variable is assigned a space of 2 bytes (2^16 = 65536 characters). 

 

 

CS50 IDE

1. comparing strings

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <cs50.h>
#include <stdio.h>
#include <string.h>
 
bool compare_strings(char *a, char *b);
 
int main(void){
    char *= get_string("enter i : ");
    if(i == NULLreturn 1;
    char *= get_string("enter j : ");
 
    //null and exclamation point is the same thing
    if(!j) return 1;
 
    if(compare_strings(i,j)) printf("same\n");
    else printf("not same\n");
 
    //strcmp returns 0 if it's equal + if i comes before j
    //- if j comes before i, a function provided by string.h
    if(strcmp(i,j) == 0printf("itworks!\n");
 
    return 0;
}
 
bool compare_strings(char *a, char *b){
    int alength = strlen(a);
    int blength = strlen(b);
 
    if(alength != blength) return false;
 
    for(int i = 0; i < alength; i++){
        if(a[i] != b[i]) return false;
    }
 
    return true;
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

compares strings if it is same or not. The key point is the run about pointers and how * works. 

 

2. String? address?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
 
//receive user input and capitalize the first letter of a given word
int main(void){
    /*char *c = get_string("type your word : ");
 
    for(int i = 0; i < strlen(c); i++){
        printf("%c : %i\n", c[i], c[i]);
    }
 
 
    if(c[0] >= 'a' && c[0] <= 'z') c[0] = c[0] - ('a' - 'A');
    printf("%s\n",c);*/
 
    string s = get_string("type your word : ");
 
    string t = s;
 
    if(strlen(t) > 0) t[0= toupper(t[0]);
 
    printf("s : %s\n", s);
    printf("t : %s\n", t);
 
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

~/ $ cd memory

~/memory/ $ make copy0

clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow copy0.c -lcrypt -lcs50 -lm -o copy0

~/memory/ $ ./copy0

type your word : taewon

s : Taewon

t : Taewon

~/memory/ $

 

I only changed t but is applied to s as well. Learning about address concept. 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
 
//receive user input and capitalize the first letter of a given word
int main(void){
 
    char *= get_string("type your word : ");
 
    //malloc stands for memory allocate
    //malloc creates a room and have to specify how many byte is required
    //for the given room
    //get the size of s, if it is david the size is 5.
    //+1 is required because compiler stops reading the memory until \0 appears
    //now for each space how many byte is required.
    //char is 1byte in C, ONLY in C because english was only used
    //since char is 1byte, sizeof is really not necessary but wrote it
    //for specification
    char *= malloc((strlen(s) + 1* sizeof(char));
 
    strcpy(t, s);
   /* for(int i = 0, n = strlen(s); i <= n; i++){
        t[i] = s[i];
    }*/
 
    if(strlen(t) > 0) t[0= toupper(t[0]);
    printf("s : %s\n", s);
    printf("t : %s\n", t);
 
    //to avoid memory leak!
    free(t);
 
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

To copy and change the value, malloc is used. Malloc means memory allocate, first we need to assign a memory size to a given variable. Since string is value + null, string length + 1 is needed to used first and we need to multiple by the data type size. Char in c is 1 byte, unlike 2 byte in java because it only supports english. since multiplying by 1 is returning itself, sizeof char is not really needed for this situation but will include it since it is more precise. 

 

Copying a value to another string(char *), we could use a for loop or a function c provides with string, a strcpy. 

When t is only used here once, we free the t to avoid memory leak.

 

3. scanning

1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>
 
int main(void){
    int x;
    printf("x : ");
    //scanf requires the address of the variable so ampersand is used &
    //ampersand means the address of that variable
    //if it's a string(char*), ampersand is not used because already an
    //address is given
    scanf("%i"&x);
    printf("x : %i\n", x);
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

ampersand gets the address while star uses that address!

 

4.  let us see address!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <cs50.h>
#include <stdio.h>
 
int main(void){
    char *= get_string("s: ");
    char *= get_string("t: ");
 
    printf("s: %p\n", s);
    printf("t: %p\n", t);
 
    //0x17686b0
    //0x means anything that comes after 0x is hexadecimal
    //17686b0 is hexadecimal, represented for memory location
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

~/memory/ $ ./addressess
s: taewon
t: weeee
s: 0x865670
t: 0x8656b0
~/memory/ $ 

 

5. swapping? use stars to apply address!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
 
void swap(int *a, int *b);
 
int main(void){
    int a = 1;
    int b = 2;
 
    printf("a is %i, b is %i\n", a, b);
    swap(&a, &b);
    printf("a is %i, b is %i\n", a, b);
 }
 
//* means address!!
//& means give me address of that value, * means go to that address of that value! different
void swap(int *a, int *b){
    int temp = *a;
    *= *b;
    *= temp;
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

 

Preprocessing – #include <stdio.h>

Compiling - programming language converts codes to assembly language for computer to understand

Assembling – using assembling code and converts to 10101010100101001010s(machine code, object code)

Linking – linking step links all the imported files, stdio.h + cs50.h + yourfile.h.

at step linking, converting all imported files into machine code and about to link them together

These days, people call these four steps compiling to be general.

 

Ram, random access memory, only runs when electricity is being charged to the device. This is the place where all the programs store memory temporary, copying the data from physical storage device and pasting it to ram. Much faster to access file from ram than from physical storage space every time you access a file.

 

Continuous memory is represented as an array. Array helps design wise and helps sufficiency.  

Printing one character at a time

 

Capitalizing all characters

 

Printing ascii per character
Prints typed arguments including program name and types all character of that argument

 

using returns

Main contains return key, just implicitly. For example, when an error occurs, a number might appear like -27, a programmer has defined the error as return -27 for that certain problem.

 

Sorting Algorithms

 

Bubble sort – repeatedly swapping the adjacent element if they are in the wrong order. For every turn, the searching size will decrease from the last place of an array.

 

Selection sort – repeatedly finding the minimum element from unsorted order. For every turn, the first place of an array increases.

How O(n^2)is calculated
Beautiful time complexity graph

Merge sort - a divide and conquer algorithm, it divides the array in two halves, and if the array is sorted, it merges with sorted arrays. O(n log n)

 

Insertion sort, gnome sort both have O(n^2) time complexity.

 

Now a day, computers are performing billions of things in a second gigahertz speed, a more readable code is more preferred in some cases.

 

Input | Source code – code we humans have written using java, c, python

              Compiler

Output | Machine code – 0 and 1s

 

Ram – temporary storage, has finite number of transistors which means there are finite of values that can be represented and stored accurately. For example, when you divide a number and add 50 more decimal place holders, the number that is displaced is imprecision, very micro value but still imprecision. For this reason finance displays dollars up to the thousands place, because back in the days when this was not obvious, people made money by adding up penny values.

 

When value reaches its’ max value, it overflows and returns to the beginning.

Cs50 sandbox

 

 

Computer science is about problem solving

 

           H              I (letter ascii)

          72             73 (decimal numbers)

      1001000        1001001 (binary 8 bit)

 

Abstraction – converting lower level details into more simplified version and focus on problem solving

Since there are so many languages that cannot be represented by 8 bit(256 different type of possibilities), now we use Unicode or utf-8 which uses 16 bit(2 to 16th power or 65536 different possibilities).

 

Rgb – a dot, pixel, uses three byte per pixel, how many red, how many green, how many blue per pixel.

An image is a group of pixels using three bytes(24 bit) in total of kilobytes, megabytes, and so fourth.

A video is a collection of images, 24 fps(frames per second) example, showing 24 images per second, showing a sequence of static images and makes it look like a moving video.

Videos -> images -> colors -> bits -> frequency of electricity

 

Input -> algorithms -> output 

Pseudo code – a simplified programming language

 verbs here are functions, questions like if else if are conditions, smith is among names is Boolean expression, go back to step2 loops

Gigahertz – GHz is a unit of measurement for AC(alternating current) or em(electromagnetic) wave frequencies equal to one billion hertz.

 

I figured I would give myself some time off by watching some movies.

 

Contains Spoiler!

 

Protagonist in this story is Andy Dufrense played by Tim Robbins, a young person with many talents at that age and a position as a vice president in the bank. He was trialed for murder for his wife and her affair golf player. Andy was sentenced to prision and while inside, he meets Red, a man who can get things for him, and gets him an rock hammer. Andy gets on the good books with the Warden and Captain Hadley for doing taxes for them. 

 

I think the movies moral point is this: 

 

A man needs to have hope in any given situation, do not give up. Although unfairly sentenced to prison, Andy did not give up hope and with rock hammer carved a hole through the wall that would take 19 years for him to achieve. Along the way he did things that would remind him of his self value to keep sanity. Doing taxes for the guards, building a library, teaching a kid for a high school qualification exam all were not only done for good reasons but for himself as well. 

 

A movie I needed for myself in current situation. I graduated with a Chinese degree because I loved the feeling living abroad. After graduating, I realized I don't want to pursue a career where a language is a sole dependent cause like service industry. Realizing what I wanted to do, I studied coding. It has been about 8months now since I have taken this journey, and finding a job I want has not been easy. Have been through a lot of interviews and frankly companies I want to work for has not given a positive feedbacks. There will be and will always will be bumps and obstacles along the roads. But I know what I want to achieve and do, and like Andy, I should always have hope and constancy with discipline is key.

GENERIC

Generic은 타입을 파라미터화해서 컴파일시 구체적인 타입이 결정되도록 한다

-      컴파일시 강한 타입 체크를 할 수 있다

-      타입변환을 제거할 수 있다. 기본적으로 object타입으로 저장을 하는데, 만약 스트링으로 사용하고 싶으면 형변환을 해야한다. 하지만 제너릭을 사용하면 처음부터

 

<? extends 클래스> = 상위에 있는 클래스들에 대한 제한

<? Super 클래스> = 하위 클래스에 있는 클래스 제한

Generic를 통한 배열을 선언할때는 new int[10] 이렇게 하면 에러가 난다. 왜냐하면 확정이 안된 타입의 변수는 선언이 불가능해서, object타입으로 선언을 해주고, 제너릭 타입으로 형변환을 시켜주면 된다.

Ex. (T)(new Object[capacity])

프로세스는 운영체제에서 할당받은 메모리를 가지고 실행합니다.

스레드는 프로세스안에서 작업을 실행하는 역할을 가지고 있습니다.

멀티프로세스 개념은 여러개의 프로세스를 가지고 있지만 서로 연관이 안되어있어서 프로세스에 에러가 발생해도 다른 프로세스는 문제 없이 작동합니다. Ex. 워드를 사용하다 오류때문에 종료를 해야되지만 엑셀은 지속적으로 사용가능한 상황.

반면 멀티스레드는 하나의 프로세스안에서 실행이되기 때문에 만약 하나의 스레드에 문제가 발생하면 다른 스레드에도 영향을 끼칩니다. Ex. 메신저어플에서 파일을 보내다가 문제가 생기면 메신저 통채로 종료되는 현상.

 

어떤 자바 애플리케이션이건 메인 스레드는 반드시 존재한다. 자바에서는 작업 스레드도 객체로 생성된다. Java.lang.Thread를 직접 객체화해도 되고 또는 상속해서 하위클래스를 사용해도 된다.

1.     Implement Runnable

2.     Extends Thread

Thread Runnable 매개값으로 받아야한다. 그래서 실행할 클래스에서 상속해서 대입할 수 있고 또는 익명객체형식으로 바로 구현이 가능하다. Runnable은 함수적 인터페이스여서 람다식방식도 가능하다.

구현을 하고나서 스레드를 실행시킬려면 .start()메소드를 사용해야 실행이된다.

Thread는 기본적으로 자기이름 + n번호를 가지고 있다. setName통해서 이름은 재정의가 가능하다.

 

멀티스레드는 동시성(Concurrency) 또는 병렬성(Parallelism)으로 실행된다.

동시성은 하나의 코어에서 멀티 스레드가 번갈아가면서 실행하고 병렬성은 멀티 코어에서 개별 스레드를 실행한다. 싱글 cpu는병렬적으로 실행이되는 것 처럼 보이지만 빠른 동시성을 실행하는 것이다.

 

스레드를 어떤 순서로 실행할지 정하는 것이 스레드 스케줄링이라고 한다.

스케줄링은 우선순위(priority)방식 그리고 순환 할당(round robin)방식을 사용한다.

우선순위 방식은 우선순위가 높은 스레드를 실행 상태를 더 많이 가지게 하는 방식이다.

순환 할당은 시간 할당량(time slice!)을 정해서 하나의 스레드를 정해진 시간만큼 실행하고 다시 다른 스레드를 실행하는 방식이다.

Priority 방식은 코드로 제어할 수 있지만 round robin 순환 할당 방식은 jvm에서 정해지기 때문에 코드로 제어할 수 없다.

우선순위느 1~10, 1이 제일 낮고 10이 가장 높다. 기본 순위는 5로 할당이된다.

setPriority로 우선순위를 정할 수 있고, 가독성을 높이기 위해 상수를 사용해도 좋다.

쿼드 코어일 경우에는 4개의 스레드가 병렬성으로 실행이 되기 때문에 우선순위 방식이 크게 영향을 미치지 못한다. (현재 사용하는 노트북은 intel i7 9th gen, 8개의 코어를 가지고 있으니 8개의 스레드까지 병렬성으로 처리 가능하네)

 

싱글 스레드 프로그램에서는 객체를 독차지해도 되지만 멀티 스레드에서는 공유 객체를 사용하면 하나의 스레드에서 변경을 하면 다른 스레드에서 원하는 결과값이 안나올 수 도 있다.

 

멀티 스레드 프로그램에서 단 하나의 스레드만 실행할 수 있는 코드 영역을 임계 영역(critical section)이라고 한다. 자바에서 임계 영역을 지정하기 위해 동기화(synchronized)를 사용한다. 스레드가 동기화 메소드 및 블록을 사용하면 잠금을 걸어 다른 스레드가 임계 영역 코드를 실행 못하게 한다.

 

스레드는 바로 실행되는게 아니라 실행대기 상태에서 스케줄링을 기달린다.

New = 스레드 객체가 생성직전

Runnable = 언제든지 실행 가능한 상태

Waiting = 다른 스레드가 통지할 때까지 기다리는 상태

Timed_waiting = 주어진 시간 동안 기다리는 상태

Blocked = 사용하고자 하는 객체의 락이 풀릴 때까지 기다리는 상태

Terminated = 실행을 마친 상태

 

Sleep()은 일시정지, interrupt()메소드가 호출되며 interruptedException이 발생해서 예외 처리가 필요하다.

 

Yield()은 다른 스레드한테 양보하는 메소드

Join()은 다른 스레드 종료를 기다리는 메소드

 

Wait()는 일시정지가 된다. 자기 스스로 실행대기로 못간다. 그래서 notify, notifyall를 사용하면 일시정지가 풀린다.

두 개의 스레드가 교대로 번갈아 가며 실행해야할 경우에 주로 사용한다.

동기화 블록 메소드에서만 호출 가능한 object메소드입니다!

스레드를 종료시킬때 stop를사용하면 자원들이 불안전한 상태로 남겨진다. 그래서 stop 플레그를 사용, while문을 통한 boolean를 사용하자. 하지만 이렇게 하면 일시정지한 스레드는 종료를 못한다. Interrupt()는 일시정지 상태에만! interruptedException이 발생해서 스레드를 종료시킨다. 즉 만약 실행상태일 경우에는 interruptedException이 발생하지 않아서 스레드를 종료를 못시킨다.

주 스레드의 작업을 돕는 보조적인 역할을 수행하는 스레드가 데몬 스레드

Ex. 위드프로세서의 자동저장, 워드가 실행이 아닌 상태에서는 자동저장 스레드의 존재가 필요가 없다.

 

스레드그룹을 사용해서 스레드끼리 묶을수 있다. 스레드 그룹의 제일 큰 역할은 interrupt인데, interrupt를 한 그룹에 사용하면 모든 스레드는 정지가 된다.

 

스레드풀- 스레드가 많이 생성되면 cpu에 저하가 생겨서 이런 현상을 방지하기위해 미리 스레드풀이란걸 만든다. 스레드를 제한된 개수만큼 생성. 작업 큐에 들어오는 작업들을 하나씩 스레드가 맏아 처리한다.

 

스레드풀 = executeservice

Runnable은 작업 처리후 리턴 값이 없고, callable은 작업 처리후 리턴 값이 있다.

스레드풀에 작업처리 요청을 하기 위해선 runnable/callable로 실행을 시켜줘야한다.

executorService는 작업 큐에있는 객체들을 처리하기 위해 두가지 메소드를 실행할 수 있다, execute 그리고 submit.

Execute는 스레드가 종료되고 해당 스레드는 제거된다. 작업 처리를 위해 새로운 스레드를 생성한다.

Submit은 스레드가 종료되지 않고 다음 작업을 위해 재사용된다.

'ETC' 카테고리의 다른 글

The Shawshank Redemption review  (4) 2019.12.16
이것이 자바다 노트3(제너릭)  (1) 2019.12.14
이것이 자바다 노트1  (0) 2019.12.09
Garbage Collector  (0) 2019.12.01
Comparable vs Comparator  (0) 2019.12.01

+ Recent posts