+ All Categories
Home > Documents > ˆ ˘ ˙ ˇ - Computer Science and...

ˆ ˘ ˙ ˇ - Computer Science and...

Date post: 06-Jul-2018
Category:
Upload: vutuong
View: 215 times
Download: 0 times
Share this document with a friend
9
! "#"$% &"’ (’ ) # ’) #&’*’#!& + ,*$% -.$/0%
Transcript

����������� ����� �� �����������������

���� ��� ���� ��������������

�������������� ������ �������!��������"�������#���" �����$ ���%

���� ��������� ������ ������������ ��&�"���'��������

�('����������� ������� ��)�����������#���� �������

�� ���'�������� ���)�� ������� ���� �#�� �������&�'��*'�#����!����&���� ��

+���������� ����� �� �����������������

������,������ �����*�����$ ���%

�-.��$�� ��/�0������%

+

1���������� ����� �� �����������������

���� ��� �������������������$����*��%

���#��"���'�������� ���#�������� ������� 2� �������34��������'�� ����� �� 5��&�# 6��24����#�7��� *�# 6����'����#�3��

��!����

����������� ����� �� �����������������

���� ��� �������������������$����*)�%

�8�#���� �������������� ('����9 "������� ��� 1���������

�� #����* �������0������!����#�����"������� ������3 ��������!����

(����'����� :���0����� �������

1

����������� ����� �� �����������������

���� ��� �������������������$��)�*������%

� 8�������� ���������������

� ���!��� ���������������

� 8�#���� ���� �� ���������������

� 2��� �#�� ������� ���������������

� ;��#*����� ���������������

� ��"������ ���������������

� ����������� ���������������

����������� ����� �� �����������������

.�5�����$���#���24%�� �������������

<���������� ����� �� �����������������

(�����#�2��$��#*"����%�� ����������������

)���������� ����� �� �����������������

(�����#�8�� ��*�� ��������������

�/'��� ���� �������&�'�!��� ���' ��'���" ��

�;�������=&�>��0� ��(���=

����������� ����� �� �����������������

8 !��*�����>��0�8��'����

������������ ����� �� �����������������

.�2��0�� �4�?

Portable OS Layer

Machine-dependent layer

User space/level

Kernel space/level

Application

Libraries

������������ ����� �� �����������������

4�?��.��#�����

Application (E.g., emacs)

Portable OS Layer

Libraries

Machine-dependent layer

Written by programmerCompiled by programmerUses function calls

�+���������� ����� �� �����������������

4�?��@�"������

Application

Portable OS Layer

Libraries (e.g., stdio.h)

Machine-dependent layer

Provided, pre-compiledDefined in headersInput to linker (compiler)Invoked like functionsMay be “resolved” when

program is loaded

<

�1���������� ����� �� �����������������

(�����#�4�?�������������

Application

Portable OS Layer

Libraries

Machine-dependent layer

system calls (read, open..)All “high-level” code

������������ ����� �� �����������������

(�����#�4�?�������������

Application

Portable OS Layer

Libraries

Machine-dependent layer

BootstrapSystem initializationInterrupt and exception I/O device driverMemory managementKernel/user mode

switchingProcessor management

)

������������ ����� �� �����������������

>�������

� /'���6�##�������������������������# 0�#�0�=

� +�*1���������� �� 6

� /'��������'���� "#����� �������������=�� 6�����������������?��'��=

� /'������������6�##������������'�!�=

� /'��������'������������ ��!�#������'��

����=

������������ ����� �� �����������������

/'��A���#�8 ��=

����!������'�������� �"���� !��������0���#�#�!�#����������##�����#�� ��&��# ��&���������6����

�� �� #��'���24�� ��'���������6 B������0�"������

while ( 1 ) ;

�2� ����� ��

�A����������� �������� ������'������

�A����������� �������� ������'������'� �'��

How ?

�<���������� ����� �� �����������������

� 6�� �2� !����A���#�8 ��=

� ���������� ������� �� �������'���6����� ����������'����������24�� �������$C0���#%� ����$C����%D

� /'������������� �����&��24�'���6�����6���'���� ��'��0���#�� ��D

� �6���'���� ������� ���$�� ��0���#�� ��%�� ��"����������24�� ���"���$"������������ %D

kernel user

Exception/Interrupt/Fault

Set user mode

Privileged instructions can be executed only in kernel mode.

�)���������� ����� �� �����������������

('�������������#������ ����������������"��'���6�������#����

� 2 6��� �����

� 8�� ������������� �

� ����������������"���?����#��!����� ;����

� 3����!����

� ����������������"���?��������������� �� �?����� �

� ���������##�


Recommended