Result of sizeof Operator in C++

Prateek Jangid
Updated on 29-Nov-2021 09:56:03

289 Views

Sizeof operator is one of the most used operators in C language used to compute the size of any data structure or data type that we pass through it. The sizeof operator returns unsigned integer type, and this operator can be applied to primitive and compound data types. We can use sizeof operator directly to data types and know the memory it is taking up −Example#include using namespace std; int main() {    cout

Buffering and Spooling in Batch Processing Operating Systems

Bhanu Priya
Updated on 29-Nov-2021 09:54:31

2K+ Views

To improve the performance and to avoid the CPU idle time the operating system uses two approaches which are explained below in detail.BufferingIt is a method of overlapping input, output and processing of a single job.After reading the data, the CPU is about to start operating on it, the input device is instructed to begin the next input immediately. The CPU and the input device are both busy. By the time the CPU is ready for the next data item the input device will have to finish its reading.The CPU then begins processing the next data while the input device ... Read More

Repeated Unit Divisibility Using C++

Prateek Jangid
Updated on 29-Nov-2021 09:52:43

207 Views

In this article, we will discuss finding the number of repeated units divisible by N. Repeated units are the repetitive numbers of 1 only, Let R(k) be the repetitive unit where k is the length of 1’s. E.g R(4) = 1111. So we need to find the minimum number of k for which R(k) is divisible by N, for example −Input : N = 13 Output : k = 6 Explanation : R(6) i.e 111111 is divisible by 13. Input : N = 31 Output : k = 15Approach to find The SolutionYou can approach this problem by checking ... Read More

Computer Architecture Supporting Operating Systems

Bhanu Priya
Updated on 29-Nov-2021 09:52:18

4K+ Views

There are different operating systems for different kinds of computers and processors. They are divided into different categories.Single processor systemSingle CPU or processor that manages the computer and it runs on a different operating system, and performs a number of tasks using one processor called a single processor system.In a single processor system different types of tasks can be performed like disk control, user control, system control etc.The figure given below depicts the single processor system −Multiprocessor systemWhen one task can be performed by using multiple processors then it is called a multiprocessor system.In a multiprocessor system a number of ... Read More

User and System Goals of Operating Systems

Bhanu Priya
Updated on 29-Nov-2021 09:49:35

3K+ Views

The design of the operating system should be defined by the goals and specifications which are affected by hardware and systems. Thus there would be user goals and system goals for an OS.User GoalsThe user goals or requirements should be as follows −The OS usage should be convenientShould be easy to use and easy to learnShould be safe and secure to use and information handling, and security should be robustShould be fast in response to the user requestsSystem GoalsThe system design requirements should be as follows −The OS should be easy to design, maintain and also to implement.Updates should be ... Read More

Removing Elements Between Two Zeros Using C++

Prateek Jangid
Updated on 29-Nov-2021 09:48:57

169 Views

In this article, we will discuss how to remove elements between two zeros from a given string that contains only zero’s and one’s character. The final string should not contain any character ‘1’ surrounded by 0’s. For example −Input : string = “110010” Output : “11000” Explanation: 1 is found between two zeros at the 4th index. Input : string = “0010” Output : “000” Explanation : 1 is found between two zeros at the 2nd index.Approach to find The SolutionWe can apply a simple approach, i.e., traverse the string using a loop and check the previous and next ... Read More

What is a System Call

Bhanu Priya
Updated on 29-Nov-2021 09:47:48

1K+ Views

System call provides an interface between user program and operating system. It is represented as follows −When the user wants to give an instruction to the OS then it will do it through system calls. Or a user program can access the kernel which is a part of the OS through system calls.It is a programmatic way in which a computer program requests a service from the kernel of the operating system.Program executes in two modes as follows −User mode − Cannot access any hardware resources, which perform only the user operations.Kernel mode − Can access hardware resources like RAM, ... Read More

Different System Calls in Operating System

Bhanu Priya
Updated on 29-Nov-2021 09:46:03

3K+ Views

The different system calls are as follows −System calls for Process managementSystem calls for File managementSystem calls for Directory managementLet us understand them one by one.System calls for Process managementA system is used to create a new process or a duplicate process called a fork. The duplicate process consists of all data in the file description and registers common. The original process is also called the parent process and the duplicate is called the child process.The fork call returns a value, which is zero in the child and equal to the child’s PID (Process Identifier) in the parent. The system ... Read More

Remove Repeated Digits in a Given Number Using C++

Prateek Jangid
Updated on 29-Nov-2021 09:44:27

573 Views

In this article, we are given a number n, and we need to remove repeated digits in a given number.Input: x = 12224 Output: 124 Input: x = 124422 Output: 1242 Input: x = 11332 Output: 132In the given problem, we will go through all the digits and remove the repeating digits.Approach to find The SolutionIn the given approach, we will go through all the digits of n from right to left now. We go through digits of n by taking mod of n with 10 and then dividing n with 10. Now our current digit is n ... Read More

Concept of System Call Mechanism

Bhanu Priya
Updated on 29-Nov-2021 09:43:37

1K+ Views

System call mechanism is one of the techniques by which a user program requests for services from the kernel. System calls always provide an interface to the services that are available by an operating system.Let us see the step by step explanation of system call mechanism as given below −Step 1 − A process that is running a user program in user mode wants to execute a read instruction a file and it has to execute a trap instruction to transfer control to the operating system.Step 2 − The read operation in system call has three parameters which are as ... Read More

Advertisements