{"id":249,"date":"2020-08-18T19:23:47","date_gmt":"2020-08-18T20:23:47","guid":{"rendered":"http:\/\/www.linux-tutorial.info\/?page_id=77"},"modified":"2020-08-22T19:26:39","modified_gmt":"2020-08-22T20:26:39","slug":"this-is-the-page-title-toplevel-84","status":"publish","type":"page","link":"http:\/\/www.linux-tutorial.info\/?page_id=249","title":{"rendered":"System Calls"},"content":{"rendered":"\n<title>System Calls<\/title>\n<question id=\"175\" text=\"The 'low-level' operations on the system are generally referred to as what?\" \/>\n<p>\nIf you are a programmer, you probably know what a <glossary>system call<\/glossary>\nis and have\nused them many times in your programs. If you are not a programmer, you may not\nknow what it is, but you still use them thousands of times a day. All\n&#8220;low-level&#8221; operations on the system are handled by system calls,\nincluding such actions as reading from the disk or printing a message on the\nscreen. System calls are the user&#8217;s <glossary>bridge<\/glossary>\nbetween user space and <glossary>kernel<\/glossary>\nspace.\nThis also means that they are the <glossary>bridge<\/glossary>\nbetween a user <glossary>application<\/glossary>and the system\nhardware.\n<\/p>\n<question id=\"\" type=\"mc\" text=\"What is the term used for a collections of service calls?\" \/>\n<concept id=\"\" description=\"Collections of system calls are often combined into more complex tasks and put into libraries\" \/>\n<p>\nCollections of system calls are often combined into more complex\ntasks and put into <i>libraries<\/i>. When using one of the functions defined in\na library, you call a <i>library function <\/i>or<i> <\/i>make a <i>library\ncall<\/i>. Even when the library routine is intended to access the hardware, it\nwill make a <glossary>system call<\/glossary>\nlong before the hardware is touched.\n<\/p>\n<p>\nEach system\ncall has its own unique identifying number. The <glossary>kernel<\/glossary>\nuses this number as an\nindex into a table of <glossary>system call<\/glossary>\nentry points, which point to where the system\ncalls reside in memory along with the number of arguments that should be passed\nto them.\n<\/p>\n<p>\nWhen a process makes a <glossary>system call<\/glossary>, the behavior is similar to\nthat of interrupts and exceptions. Like exception handling, the general\npurpose registers and the number of the <glossary>system call<\/glossary>\nare pushed onto the <glossary>stack<\/glossary>.\nNext, the <glossary>system call<\/glossary>\nhandler is invoked, which calls the routine within the\nkernel that will do the actual work.\n<\/p>\n<p>\nAlthough there are hundreds of\nlibrary calls, each of these will call one or more systems calls. In total,\nthere are about 150 system calls, all of which have to pass through this one point\n(referred to as a &#8220;call gate&#8221;) to ensure that user code moves up to the higher privilege level at a\nspecific location (<glossary>address<\/glossary>)within the\n<glossary>kernel<\/glossary>. Therefore, uniform\ncontrols can be applied to ensure that a process is not doing something it\nshouldn&#8217;t.\n<\/p>\n<p>\nAs with interrupts and exceptions, the system checks to see\nwhether a <glossary>context switch<\/glossary>\nshould occur on return to <glossary>user mode<\/glossary>.\n If so, a context\nswitch takes place. This is possible in situations where one process made a\nsystem call and an <glossary>interrupt<\/glossary>\noccurred while the process was in <glossary>kernel<\/glossary>\nmode. The\nkernel then issued a wake_up() to all\nprocesses waiting for data from the hard disk.\n<\/p>\n<p>\nWhen the interrupt\ncompletes, the <glossary>kernel<\/glossary>\nmay go back to the first process that made the system\ncall. But, then again, there may be another process with a higher priority.\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>System Calls If you are a programmer, you probably know what a system call is and have used them many times in your programs. If you are not a programmer, you may not know what it is, but you still &hellip; <a href=\"http:\/\/www.linux-tutorial.info\/?page_id=249\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-249","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=249"}],"version-history":[{"count":1,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/249\/revisions"}],"predecessor-version":[{"id":720,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/249\/revisions\/720"}],"wp:attachment":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}