분류 전체보기 1341

Ch01. 프로세스와 스레드 소개 - 스레드와 스케줄링

프로세스는 실행 환경과 자원을 제공하는 컨테이너 역할을 하고, 실제 CPU를 사용해서 코드를 하나하나 실행하는 것은 스레드이다.  프로세스 A에 있는 스레드 A1을 실행한다.프로세스A에 있는 스레드A1의 실행을 잠시 멈추고 프로세스B에 있는 스레드 B1을 실행한다.프로세스B에 있는 스레드 B1의 실행을 잠시 멈추고 같은 프로세스의 스레드 B2를 실행한다.이후에 프로세스A에 있는 스레드A1을 실행한다.이 과정을 반복한다.단일 코어 스케줄링운영체제는 내부에 스케줄링 큐를 가지고 있고, 각각의 스레드는 스케줄링 큐에서 대기한다.스레드A1, 스레드B1, 스레드B2가 스케줄링 큐에 대기한다.운영체제는 스레드A1을 큐에서 꺼내고 CPU를 통해 실행한다.이때 스레드A1이 프로그램의 코드를 수행하고, CPU를 통한 연..

Ch01. 프로세스와 스레드 소개 - 프로세스와 스레드

프로세스프로그램은 실제 실행하기 전까지는 단순한 파일에 불과하다.프로그램을 실행하면 프로세스가 만들어지고 프로그램이 실행된다.이렇게 운영체제 안에서 실행중인 프로그램을 "프로세스"라 한다.프로세스는 실행 중인 프로그램의 "인스턴스"이다.자바 언어로 비유를 하자면 클래스는 프로그램이고, 인스턴스는 프로세스이다.프로세스는 실행 중인 프로그램의 인스턴스이다. 각 프로세스는 독립적인 메모리 공간을 갖고 있으며, 운영체제에서 별 도의 작업 단위로 분리해서 관리된다. 각 프로세스는 별도의 메모리 공간을 갖고 있기 때문에 서로 간섭하지 않는다. 그 리고 프로세스가 서로의 메모리에 직접 접근할 수 없다. 프로세스는 이렇듯 서로 격리되어 관리되기 때문에, 하나의 프 로세스가 충돌해도 다른 프로세스에는 영향을 미치지 않는..

Ch01. 프로세스와 스레드 소개 - 멀티 Tasking과 멀티 Processing

멀티태스킹과 멀티프로세싱 단일 프로그램 실행만약 프로그램을 2개 이상 동시에 실행한다고 가정해보자. 예를 들어서 음악 프로그램을 통해 음악을 들으면서, 동시에 워드 프로그램을 통해 문서를 작성하는 것이다. 여기서는 연산을 처리할 수 있는 CPU 코어가 1개만 있다고 가정.프로그램의 실행이란 프로그램을 구성하는 코드를 순서대로 CPU에서 연산(실행)하는 일이다.여기서 CPU 코어는 하나로 가정하므로, 한 번에 하나의 프로그램 코드만 실행할 수 있다.이때, 하나의 프로그램 안에 있는 코드를 모두 후에야 다른 프로그램의 코드를 실행할 수 있다면? 예를 들어 음악 프로그램이 끝난 뒤에야 워드 프로그램을 실행할 수 있다면 컴퓨터 사용자는 매우 답답할 것이다.실제로 초창기의 컴퓨터는 이 처럼 한 번에 하나의 프로그..

Ch09. 배치 작업 실행 하기 (스프링 스케줄링)

https://spring.io/blog/2020/11/10/new-in-spring-5-3-improved-cron-expressions New in Spring 5.3: Improved Cron Expressions If you regularly listen to A Bootiful Podcast, you might have heard about the improvements we made to Spring Framework’s cron support. Cron expressions are mostly used in Spring applications through the @Scheduled annotation. In Spring 5.3, we introduced spring.io applicatio..

Ch08. 좋은 코드의 기본 테스트 코드 작성하기

초기 설정 build.gradle dependencies { //... testRuntimeOnly 'com.h2database:h2' } SpringBatchTestConfig /** * 배치 전역에서 사용하기 위한 config */ @Configuration @EnableAutoConfiguration @EnableBatchProcessing public class SpringBatchTestConfig { } test 의존성에는 h2 Database를 사용할 것이므로 build.gradle 파일에 Import 한다. Test 코드에서 전역으로 사용할 설정 파일을 생성한다. 여기서는 특별한 일을 하지는 않는다 DataBase를 사용하지 않는 Test HelloWorldJobConfigTest @Run..

Ch07. 여러개의 step 구동 및 실행 상태에 따른 분기처리

여러 개의 STEP https://docs.spring.io/spring-batch/docs/current/reference/html/index-single.html#SequentialFlow Spring Batch - Reference Documentation If a group of Steps share similar configurations, then it may be helpful to define a “parent” Step from which the concrete Steps may inherit properties. Similar to class inheritance in Java, the “child” Step combines its elements and attributes wit do..

Ch06. 배치 작업의 기본, 파일 읽기와 쓰기

https://docs.spring.io/spring-batch/docs/current/reference/html/index-single.html#simpleDelimitedFileReadingExample Spring Batch - Reference Documentation If a group of Steps share similar configurations, then it may be helpful to define a “parent” Step from which the concrete Steps may inherit properties. Similar to class inheritance in Java, the “child” Step combines its elements and attribute..

Ch05. DB 데이터 이관 하기 (DB 데이터 읽고 쓰기)

DB Reader https://docs.spring.io/spring-batch/docs/current/reference/html/readersAndWriters.html#repositoryItemReader ItemReaders and ItemWriters So far, only delimited files have been discussed in much detail. However, they represent only half of the file reading picture. Many organizations that use flat files use fixed length formats. An example fixed length file follows: The following example..

Ch04. 배치 작업 실행 전, 후 로그 추가를 위한 리스너

https://docs.spring.io/spring-batch/docs/current/reference/html/job.html#interceptingJobExecution Configuring and Running a Job Because the script launching the job must kick off a Java Virtual Machine, there needs to be a class with a main method to act as the primary entry point. Spring Batch provides an implementation that serves this purpose: CommandLineJobRunner. Note that thi docs.spring.i..

Ch03. 배치 실행 시 파라미터 (파일 이름) 받기 및 (csv)검증

https://docs.spring.io/spring-batch/docs/current/reference/html/job.html#jobparametersvalidator Configuring and Running a Job Because the script launching the job must kick off a Java Virtual Machine, there needs to be a class with a main method to act as the primary entry point. Spring Batch provides an implementation that serves this purpose: CommandLineJobRunner. Note that thi docs.spring.io ..