본문 바로가기

분류 전체보기

(40)
[Javascript] array sort 다중 조건 성적값으로 내림차순, 같은 성적이라면 이름값을 사전순(오름차순)으로 나열하고 싶다. 기존 코드 array.sort((a, b) => { if (b.score - a.score 0) return 1; else if (b.name b.score - a.score - (a.name < b.name)); 승률(desc), 이긴횟수(desc), 체중(desc), 번호(asc) 기준으로 정렬할 때 위의 방법으로 하면 단위가 모두 달라 적용하기 힘들다. 기존 코드 const result = array.sort((a, b)..
[JWT] 클라이언트에서의 관리 JWT (Json Web Token) What is JWT ? ​ aaaaaa . bbbbbb . cccccc ​ 헤더(header) 내용(payload) 서명(signature) Header typ : 토큰 타입 "JWT" alg : 해싱알고리즘 "HS256" 혹은 "RSA" Payload registered claim iss, sub, exp, jti 등등 public claim private claim (claim : 정보를 담는 조각. 단위) Signature hash(encode(Header) + "." +encode(Payload) , secret) 클라이언트에서 jwt를 어떻게 관리할 것 인지 ? 쿠키 or 로컬스토리지 쿠키와 로컬스토리지의 차이는? LocalStorage Cookie 장점 ..
[JavaScript] 문자열 반복되는 문자열 생성 const BLANK = "_"; const result = BLANK.repeat(number); 문자열 합치기 1. +연산 const a = "_"; const b = "+"; const c = "-"; const result = a + b + c; 2. list to string (join) const a = "_"; const b = "+"; const c = "-"; const result = []; result.push(a,b,c); result.join(""); 성능 비교 (1) 59175 ms vs (2) 220 ms https://stackoverflow.com/questions/2087522/does-javascript-have-a-built-in-stringbui..
Chapter 06. Process Syncronization and Mutual Exclusion (5of7) - OS supported Sol2 - Semaphore Mutual Exclusion Solutions SW solutions Dekker's algorithm (Peterson's alogorithm) Dijstra's algorithm, Knuth's algo, Eisenberg and McGuire's algo, Lamport's algo HW solution TestAndSet(TAS) instruction OS supported SW solution Spinlock Semaphore Eventcount/sequencer Language-Level solution Monitor busy waiting을 해결하기 위해 Semaphore (또!) dijkstra가 제안 Busy waiting 문제 해결 !!! 음이 아닌 정수형 변수(S) 초기화 연산, P..
Chapter 06. Process Syncronization and Mutual Exclusion (4of7) - OS supported Sol1 - Spinlock Mutual Exclusion Solutions SW solutions Dekker's algorithm (Peterson's alogorithm) Dijstra's algorithm, Knuth's algo, Eisenberg and McGuire's algo, Lamport's algo HW solution TestAndSet(TAS) instruction OS supported SW solution Spinlock Semaphore Eventcount/sequencer Language-Level solution Monitor SW와 HW solution의 busy waiting을 해결하기 위해 SpinLock 정수 변수 (조금 특별한!) 초기화, P(), V() 연산으로만 접근 가능한 변수 위 연산..
Chapter06. Process Syncronization and Mutual Exclusion (3of7) - HW solution Mutual Exclusion Solutions SW solutions Dekker&#39;s algorithm (Peterson&#39;s alogorithm) Dijstra&#39;s algorithm, Knuth&#39;s algo, Eisenberg and McGuire&#39;s algo, Lamport&#39;s algo HW solution TestAndSet(TAS) instruction OS supported SW solution Spinlock Semaphore Eventcount/sequencer Language-Level solution Monitor Synchronization Hardware TestAndSet (TAS) instruction Test와 Set을 한번에 수행하는 ..
Chapter 06. Process Syncronization and Mutual Exclusion (2of7) - SW solutions Mutual Exclusion Solutions SW solutions Dekker&#39;s algorithm (Peterson&#39;s alogorithm) Dijstra&#39;s algorithm, Knuth&#39;s algo, Eisenberg and McGuire&#39;s algo, Lamport&#39;s algo HW solution TestAndSet(TAS) instruction OS supported SW solution Spinlock Semaphore Eventcount/sequencer Language-Level solution Monitor Dekker&#39;s Algorigthm Two process ME을 보장하는 최초의 알고리즘 flag와 turn 둘 다 사용. /..
Chapter 06. Process Syncronization and Mutual Exclusion (1of7) - Instruction 프로세스 동기화 & 상호배제 Process Syncronization (동기화) 다중 프로그래밍 시스템 여러 프로세스들 존재 프로세스들은 서로 독립적으로 동작 (동시에 동작) 공유 자원 또는 데이터가 있을 때, 문제 발생 가능 (둘이 대화로 풀어야한다) (대화하는 작업이 동기화) 동기화 (Syncronzation) 프로세스들이 서로 동작을 맞추는 것 프로세스들이 서로 정보를 공유하는 것 Asyncronous and Concurrent P&#39;s 비동기적 (Asyncronous) 프로세스들이 서로에 대해 모름 병행적 (Concurrent) 여러 개의 프로세스들이 동시에 시스템에 존재 병행 수행중인 비동기적 프로세스들이 공유 자원에 동시에 접근할때 문제가 발생할 수 있음 Terminologies (용어정..