Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Arnab Chakraborty
Page 8 of 377
Difference between Deadlock Prevention and Deadlock Avoidance
Deadlock prevention and avoidance are crucial techniques in operating systems to ensure continuous operation without system-wide halts. Deadlocks can cause data loss, system downtime, and reduced productivity, making these techniques essential for maintaining system availability and reliability. What is Deadlock? A deadlock is a situation where two or more processes are unable to proceed because they are waiting for each other to release resources. This creates a circular dependency where processes remain stuck in a waiting state, causing a system-wide halt. Deadlock occurs when four conditions are met simultaneously: mutual exclusion, hold and wait, no preemption, and circular ...
Read MoreProgram execution in CPU
One may be amazed how the CPU is programmed. A special register is contained in CPU − the instruction register − whose bit pattern determines what the CPU will do. Once that action has been completed, the bit pattern in the instruction register can be changed, and the CPU will perform the operation specified by this next bit pattern. Most of the modern CPUs use an instruction queue. Some instructions are waiting in the queue, ready to be executed. Different electronic circuitry keeps the instruction queue full while the control unit is executing the instructions. But this is simply ...
Read MoreProcess Communication in Operating System
Processes executing concurrently in an operating system can be classified as independent processes or cooperating processes. An independent process cannot affect or be affected by other processes in the system and does not share data with any other process. A cooperating process can affect or be affected by other processes and shares data with them. Why Process Cooperation is Important Operating systems provide environments that support process cooperation for several key reasons: Information sharing − Multiple users may need concurrent access to the same information, such as shared files or databases. Computation speedup − Tasks can ...
Read MoreGarbage collection(GC) in JavaScript?
Memory management in JavaScript is much easier than in low-level languages like C or C++. Unlike low-level languages, JavaScript automatically detects which objects will be needed in later cases and which will be garbage that is occupying memory without any reason. In this article, we shall discuss how garbage collection (GC) works in JavaScript. There are a few important parts that we are going to discuss in detail: Reachability from root Interlinked Objects (interconnections between different objects) Unreachable Collections (Broken link) Reachability The first concept of ...
Read MoreHow to know whether a value is searched in Javascript sets?
In JavaScript, sets are collections of unique values. Sometimes you need to check whether a specific element exists inside a set. In this article, we will explore different techniques to verify element presence in JavaScript sets. Using for Loop (Manual Search) You can search for an element by iterating through the set and comparing each element with the target value. If found, return true; otherwise, return false after checking all elements. HTML Console Output Console Output: ...
Read MoreHow to make your code faster using JavaScript Sets?
While writing code, we always try to make our code easier to read, less complex, more efficient, and smaller in size. For that, we follow several methodologies which make our code efficient. In this article, we shall focus on some techniques based on JavaScript Sets to perform certain array-like or collection-based applications which will run faster and the code will also be concise. How Sets Differ from Arrays Arrays are indexed collections where each element is associated with a specific index. On the other hand, Sets are keyed collections where data elements are ordered based on their key ...
Read MoreMixins in JavaScript
Multiple-inheritance is not supported by JavaScript by default. But sometimes we need to mix multiple object properties into a single object. Object property sharing can be done using mixins. In this article, we shall cover what are mixins in JavaScript. The definition of mixins can be stated as mixins is a class that contains methods that can be used by other classes without inheriting from that class. The methods in mixin provide certain behavior which is not used alone but can be used to add these behaviors to other classes. Basic Mixin with Object.assign() See the following ...
Read MoreHow to return the response from an asynchronous call in Javascript?
Asynchronous programming is common in JavaScript network programming. In this approach, we can download data or perform time-dependent operations without blocking the current execution flow. This article explores techniques to return responses from asynchronous calls in JavaScript. Before diving into solutions, let's examine a common problem developers face with asynchronous calls: The Problem function aTrivialFunction() { ajaxCall(..., function onSuccess(result) { // How do we return result from this function? }); } console.log('result of aTrivialFunction:', aTrivialFunction()); // undefined This AJAX call represents a ...
Read MoreHow to pretty print json using javascript?
JavaScript Object Notation (JSON) is a standard format for storing and exchanging data. When working with JavaScript objects, displaying them in a readable format can be challenging, especially with complex nested structures. This article explores methods to pretty print JSON using JavaScript's built-in capabilities. The Problem with Default Object Display When you directly display a JavaScript object, it often appears as [object Object] or in a compact, unreadable format. Let's see this with a simple example: JSON Pretty Print Demo Output Console ...
Read MoreWhat are the characteristics of JavaScript 'Strict Mode'?
JavaScript strict mode enables stricter parsing and error handling in your JavaScript code. By default, JavaScript runs in "sloppy mode" which allows certain questionable practices. Strict mode helps you write more secure and optimized code by catching common coding mistakes. Syntax Strict mode can be enabled in different scopes using the "use strict" directive: Global Strict Mode "use strict"; // All code in this script runs in strict mode Function Strict Mode function myFunction() { "use strict"; // Only this function runs in strict mode ...
Read More