Skip to content

Commit

Permalink
[고동희] 6-13주차 미션 제출 (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
High-East authored Jul 6, 2024
1 parent 475c628 commit 17635d2
Show file tree
Hide file tree
Showing 20 changed files with 131 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 8th_members/고동희/10주차.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 10주차

## 싱글 프로세스 + 싱글 스레드
![alt text](week_10_single.png)

## 싱글 프로세스 + 멀티 스레딩
![alt text](week_10_multi_threading.png)

## 싱글 프로세스 + 멀티 스레딩 (개수 제한)
![alt text](week_10_multi_threading2.png)
79 changes: 79 additions & 0 deletions 8th_members/고동희/11주차.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# 11주차

## Set 내부 구조 살펴보기
```
PyTypeObject PySet_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"set", /* tp_name */
sizeof(PySetObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)set_dealloc, /* tp_dealloc */
0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_as_async */
(reprfunc)set_repr, /* tp_repr */
&set_as_number, /* tp_as_number */
&set_as_sequence, /* tp_as_sequence */
0, /* tp_as_mapping */
PyObject_HashNotImplemented, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE, /* tp_flags */
set_doc, /* tp_doc */
(traverseproc)set_traverse, /* tp_traverse */
(inquiry)set_clear_internal, /* tp_clear */
(richcmpfunc)set_richcompare, /* tp_richcompare */
offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */
(getiterfunc)set_iter, /* tp_iter */
0, /* tp_iternext */
set_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)set_init, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
set_new, /* tp_new */
PyObject_GC_Del, /* tp_free */
.tp_vectorcall = set_vectorcall,
};
```

```
static void
set_dealloc(PySetObject *so)
{
setentry *entry;
Py_ssize_t used = so->used;
/* bpo-31095: UnTrack is needed before calling any callbacks */
PyObject_GC_UnTrack(so);
Py_TRASHCAN_BEGIN(so, set_dealloc)
if (so->weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *) so);
for (entry = so->table; used > 0; entry++) {
if (entry->key && entry->key != dummy) {
used--;
Py_DECREF(entry->key);
}
}
if (so->table != so->smalltable)
PyMem_DEL(so->table);
Py_TYPE(so)->tp_free(so);
Py_TRASHCAN_END
}
```
1. set 객체는 삭제될 때(destruction), set_dealloc 함수를 호출한다.
2. set_dealloc 함수는 가비지 컬렉터의 추적 대상에서 제외하고, 약한 참조 리스트를 클리어 하는 등의 작업을 한다.
3. 약한 참조 리스트를 클리어한다고 해서, 약한 참조 리스트에 포함되어 있는 다른 객체들의 메모리가 해제되는 것은 아니다.

4 changes: 4 additions & 0 deletions 8th_members/고동희/12주차.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 12주차

## unittest 사용하기
![alt text](week_12.png)
7 changes: 7 additions & 0 deletions 8th_members/고동희/13주차.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 13주차

## pdb 실행해보기
![alt text](week_13_debug.png)

## CProfile 실행해보기
![alt text](week_13_profile.png)
4 changes: 4 additions & 0 deletions 8th_members/고동희/6주차.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 6주차

## 프레임 객체 생성하기
![alt text](week_6.png)
4 changes: 4 additions & 0 deletions 8th_members/고동희/7주차.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 7주차

## tracemalloc 모듈 사용해서 직접 메모리 확인해보기
![alt text](week_7.png)
4 changes: 4 additions & 0 deletions 8th_members/고동희/8주차.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 8주차

## sys.getrefcount 사용해보기
![alt text](week_8.png)
11 changes: 11 additions & 0 deletions 8th_members/고동희/9주차.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 9주차

## 싱글 프로세스
![alt text](week_9_single.png)

## 멀티 프로세스
![alt text](week_9_multi.png)

## 결론
- 싱글: 1초
- 멀티: 0.48초
8 changes: 8 additions & 0 deletions 8th_members/고동희/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import instaviz

def hello():
name = 'donghee'
text = 'hello ' + name
return name

instaviz.show(hello)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8th_members/고동희/week_10_single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8th_members/고동희/week_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8th_members/고동희/week_13_debug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8th_members/고동희/week_13_profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8th_members/고동희/week_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8th_members/고동희/week_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8th_members/고동희/week_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8th_members/고동희/week_9_multi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8th_members/고동희/week_9_single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 17635d2

Please sign in to comment.