본문 바로가기

분류 전체보기

(51)
뮤텍스(Mutex) VS 모니터(Monitor) 간단하게 말해서 Monitor 는 Mutex + Condition Variable 이다. Monitor 의 이해를 돕기 위해 아래 코드를 살펴보자. 아래 코드를 보면 predicate 라는 부분이 나오는데, 이 부분은 스레드간 선제조건을 의미한다. 즉, 이 값이 true 가 되었다는 것은 이전에 인과의 관계에 속해있는 사전 작업이 완료되었다는 것을 의미하고 그때 현재 스레드의 작업을 수행할 수가 있다. void example() { // acquire mutex while (predicate is false) { // release mutex // acquire mutex } // do something in this thread. // release mutex } 위 코드의 flow 를 보면, 먼저 m..
허리디스크 아이고 허리야 허리디스크가 왔다. 좋지 못한 자세로 10년 가까이 개발자 생활을 하니 당연한 결과인가... 최근 들어서 유독 골반과 다리가 뻣뻣하다는 느낌을 받곤 했었는데, 무심히 지나가곤 했다. 그런데 어느날부터인가 뻣뻣한 느낌을 넘어서... 뭐라고 해야 하나.. 저리면서 찌릿찌릿한 근육통과는 확연히 다른 느낌이 와서 MRI 를 찍어보니 허리디스크가 튀어나왔다는 결과가 나왔다 ㅠㅠ ( 혹시 이 글을 보시는 분 이와 같은 증상이 있으면 검사 꼭 받아보세요) 지금까지 신경차단주사를 3번 맞고, 감압치료 도수치료는 병행한 결과 처음보다는 확연히 나아졌지만 아직도 증상이 좋진 않다. 무슨 일이 하나 생기면 워낙 이거저거 찾아보는 성격이라.. 디스크 관련해서 찾아보니.. 정말 극도로 심한 상태가 아닌 경우에는 ..
[leetcode] 127. Word Ladder A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words such that: The first word in the sequence is beginWord. The last word in the sequence is endWord. Only one letter is different between each adjacent pair of words in the sequence. Every word in the sequence is in wordList. Given two words, beginWord and endWord, and a dictionary wordL..
[leetcode] 588. Design In-Memory File System Design an in-memory file system to simulate the following functions: ls: Given a path in string format. If it is a file path, return a list that only contains this file's name. If it is a directory path, return the list of file and directory names in this directory. Your output (file and directory names together) should in lexicographic order. mkdir: Given a directory path that does not exist, y..
[leetcode] Exclusive Time of Functions On a single-threaded CPU, we execute a program containing n functions. Each function has a unique ID between 0 and n-1. Function calls are stored in a call stack: when a function call starts, its ID is pushed onto the stack, and when a function call ends, its ID is popped off the stack. The function whose ID is at the top of the stack is the current function being executed. Each time a function ..
[leetcode] 1423. Maximum Points You Can Obtain from Cards There are several cards arranged in a row, and each card has an associated number of points The points are given in the integer array cardPoints. In one step, you can take one card from the beginning or from the end of the row. You have to take exactly k cards. Your score is the sum of the points of the cards you have taken. Given the integer array cardPoints and the integer k, return the maximu..
신경망 학습 - 1 이번에는 신경망의 학습에 대해 알아보자. 학습이란 훈련 데이터로부터 가중치 매개변수의 최적값을 자동으로 획득하는 것을 뜻한다. 손실함수의 결과 값을 가장 작게 만드는 가중치 매개변수를 찾는 것이 이번장의 목표인데, 이 기법으로 함수의 기울기를 활용하는 경사법을 소개한다. 1. 데이터에서 학습한다. 1-1. 데이터 주도 학습 머신러닝과 딥러닝의 학습 매커니즘의 차이는 feature 를 인간이 설계 하느냐 feature 까지도 기계가 설계 하느냐에 달려있다. 예를 들어, 이미지 인식이라고 하면 머신러닝은 이미지에서 feature 를 추출하고 그 특징의 패턴을 기계학습 기술로 학습하게 될 것이다. 여기서 말하는 feature 는 입력데이터에서 본질적인 데이터를 정확하게 추출할 수 있도록 설계된 변환기를 말한다..
[leetcode] 210. Course Schedule II There are a total of n courses you have to take labelled from 0 to n - 1. Some courses may have prerequisites, for example, if prerequisites[i] = [ai, bi] this means you must take the course bi before the course ai. Given the total number of courses numCourses and a list of the prerequisite pairs, return the ordering of courses you should take to finish all courses. If there are many valid answe..
[leetcode] 211. Design Add and Search Words Data Structure Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class: WordDictionary() Initializes the object. void addWord(word) Adds word to the data structure, it can be matched later. bool search(word) Returns true if there is any string in the data structure that matches word or false otherwise. word may conta..
다중 우주의 네가지 모형 (Level 1 ~ Level 4) 스웨덴 출신의 물리학자인 맥스 테그마크는 과학자들이 다중 우주라는 단어를 서로 다르게 사용한다는 사실을 알게 되었고, 이를 종합해서 레벨 1~4 까지의 네 가지 모형으로 정리했다. Level 1 첫 번째 다중 우주론 모델은 우리 우주를 넘어선 영역을 또 다른 우주로 인정하는 것이다. 빅뱅 직후, 1초도 되지 않는 짧은 시간동안 우주는 매우 빠르게 급팽창 했다. 팽창의 속도 자체가 증가하면서 가속 팽창한 것인데, 우주 초기에 대한 이러한 설명을 인플레이션 이론이라고 한다. 오늘날의 과학자들은 일반적으로 빅뱅 다음에 인플레이션이 있었음을 의심하지 않는 편인데, 이 우주의 팽창 속도는 지금까지도 계속 증가하고 있다. 그리고 이 가속된 팽창 속도가 마침내 빛의 속도를 초월해서 커져나갔다, 우리 우주의 나이가 대..