avatarDr. Ashish Bamania

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3299

Abstract

 </div>
        </div>
      </a>
    </div><h1 id="5838">3. Semaphores</h1><p id="5dd8">A Semaphore is a variable or an abstract data type that is used for controlling access to a common resource by multiple threads during concurrent programming.</p><p id="149b">Semaphores prevent race conditions.</p><p id="44f0">These are situations where two or more threads access shared data at the same time and cause unintended results.</p><p id="b04f">Two important operations that are performed on a semaphore are:</p><ul><li><b>Wait (P)</b></li></ul><p id="0a80">This decreases the value of a semaphore.</p><p id="72f8">When the value of a semaphore becomes negative, then the thread performing the wait operation is blocked.</p><ul><li><b>Signal (V)</b></li></ul><p id="96e4">This operation increases the value of a semaphore.</p><p id="0111">If the value of the semaphore is 0 or positive, the process continues execution.</p><figure id="b221"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*hhTimNgp_tAM7qW9"><figcaption>Photo by <a href="https://unsplash.com/es/@metriics?utm_source=medium&amp;utm_medium=referral">Stephane Gagnon</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h1 id="4d0f">4. Garbage Collection Algorithms</h1><p id="3e52">These are automatic memory management algorithms used by languages like Python and JavaScript where manual management of memory is not required.</p><p id="3411">These algorithms automatically reclaim memory previously allocated to objects that are no longer using it.</p><p id="29e5">Some important garbage collection algorithms are:</p><ul><li>Mark-Sweep algorithm</li><li>Mark-Compact algorithm</li><li>Copy Collection algorithm</li><li>Generational Garbage Collection algorithm</li><li>Reference Counting algorithm</li></ul><figure id="c312"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*mKhuEbN8Bt1TmcIO"><figcaption>Photo by <a href="https://unsplash.com/@possessedphotography?utm_source=medium&amp;utm_medium=referral">Possessed Photography</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h1 id="8d26">5. Quantum Entanglement</h1><p id="45c4">Quantum entanglement is a phenomenon in Quantum Mechanics where two or more particles are linked (entangled) and instantaneously affect each other’s state no matter how far apart in space they are.</p><p id="e181">Consider two qubits (the fundamental unit in a Quantum computer).</p><p id="fc72">If two qubits are entangled, measuring the state of the first will change the value of the other.</p><p id="9fba">Two entangled qubits are represented by Bell’s state, as follows:</p><p id="548b" type="7">|Ψ⟩ = 1/√2 ( |00⟩ + |11⟩ )</p><p id="6ea1">The property of Entanglement is used to create Quantum gates and perform complex quantum computations.</p><p id="54e0">If you are new to Quantum computing and looking to learn about it, check out my article series below:</p><div id="15e9" class="link-block">
      <a href="https://levelup.gitconnected.com/all-the-math-that-you-need-to-start-doing-quantum-computing-part-i-8bc668014ad4">
        <div>
          <div>
            <h2>All The Math That You Need 

Options

To Start Doing Quantum Computing (Part-I)</h2> <div><h3>Easy Lessons for An Absolute Beginner to Quantum Computing</h3></div> <div><p>levelup.gitconnected.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*R_r_dcDkcBMGVM9LcVeHXQ.png)"></div> </div> </div> </a> </div><h2 id="bcff">If you’re a beginner to Python or Machine Learning, check out my books below:</h2><div id="6782" class="link-block"> <a href="https://bamaniaashish.gumroad.com/l/python-book"> <div> <div> <h2>The No Bullst Guide To Learning Python</h2> <div><h3>Are you someone who is thinking about learning to program but does not know where to start? </h3></div> <div><p>bamaniaashish.gumroad.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*IzmR1fn8tnDUwtMW)"></div> </div> </div> </a> </div><div id="b228" class="link-block"> <a href="https://bamaniaashish.gumroad.com/l/ai_book"> <div> <div> <h2>The No Bullst Guide To Learning Artificial Intelligence</h2> <div><h3>Hey there! Are you someone who wants to learn about AI but does not know where to begin?</h3></div> <div><p>bamaniaashish.gumroad.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*f2NnQeA-HCVPwdTM)"></div> </div> </div> </a> </div><div id="ddba" class="link-block"> <a href="https://bamania-ashish.medium.com/membership"> <div> <div> <h2>Join Medium with my referral link — Dr. Ashish Bamania</h2> <div><h3>Read every story from Dr. Ashish Bamania (and thousands of other writers on Medium). Your membership fee directly…</h3></div> <div><p>bamania-ashish.medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*Bk4zPehgusbJoPFe)"></div> </div> </div> </a> </div><h1 id="4d0c">Level Up Coding</h1><p id="6588">Thanks for being a part of our community! Before you go:</p><ul><li>👏 Clap for the story and follow the author 👉</li><li>📰 View more content in the <a href="https://levelup.gitconnected.com/?utm_source=pub&amp;utm_medium=post">Level Up Coding publication</a></li><li>💰 Free coding interview course ⇒ <a href="https://skilled.dev/?utm_source=luc&amp;utm_medium=article">View Course</a></li><li>🔔 Follow us: <a href="https://twitter.com/gitconnected">Twitter</a> | <a href="https://www.linkedin.com/company/gitconnected">LinkedIn</a> | <a href="https://newsletter.levelup.dev">Newsletter</a></li></ul><p id="c4ac">🚀👉 <a href="https://jobs.levelup.dev/talent/welcome?referral=true"><b>Join the Level Up talent collective and find an amazing job</b></a></p></article></body>

These Are The Top 5 Most Difficult Concepts In Computer Science According To GPT-4

Photo by Jorge Ramirez on Unsplash

1. Lamport’s Bakery Algorithm

During concurrent computing, multiple threads simultaneously access the same resources on the computer.

This can lead to data inconsistency if two threads access and change data at the same memory location or do this in different sequences.

Using a bakery as the analogy, Lamport developed this algorithm to prevent threads from entering the critical sections of code concurrently.

The algorithm ensures that:

  • every process enters the critical section (preventing starvation)
  • no two processes are in the critical section at the same time (ensuring mutual exclusion)

The algorithm works as follows:

  1. A thread gets a unique ticket number when it enters the critical section of the code
  2. It checks the other threads for a smaller or equal ticket number. If unable to find one, it enters the critical section. Note that the thread with the lower ticket number enters the critical section first.
  3. The thread performs its function in the critical section
  4. After performing the function, the thread sets its ticket number to 0 or null.
Photo by Christian Wiediger on Unsplash

2. Elliptic Curve Cryptography

Elliptic Curve Cryptography (ECC) is a public key cryptography technique that is based on elliptic curves over finite fields.

An Elliptic curve is defined by the equation as follows:

y² = x³ + ax + b

A Finite field is a set of numbers on which the operations of multiplication, addition, subtraction and division are defined and satisfy certain basic rules.

ECC is used in:

  • SSL/TLS
  • secure shell connections (SSH)
  • virtual private networks (VPN)
  • Blockchains & Cryptocurrencies

Check out my article that describes ECC in detail below:

3. Semaphores

A Semaphore is a variable or an abstract data type that is used for controlling access to a common resource by multiple threads during concurrent programming.

Semaphores prevent race conditions.

These are situations where two or more threads access shared data at the same time and cause unintended results.

Two important operations that are performed on a semaphore are:

  • Wait (P)

This decreases the value of a semaphore.

When the value of a semaphore becomes negative, then the thread performing the wait operation is blocked.

  • Signal (V)

This operation increases the value of a semaphore.

If the value of the semaphore is 0 or positive, the process continues execution.

Photo by Stephane Gagnon on Unsplash

4. Garbage Collection Algorithms

These are automatic memory management algorithms used by languages like Python and JavaScript where manual management of memory is not required.

These algorithms automatically reclaim memory previously allocated to objects that are no longer using it.

Some important garbage collection algorithms are:

  • Mark-Sweep algorithm
  • Mark-Compact algorithm
  • Copy Collection algorithm
  • Generational Garbage Collection algorithm
  • Reference Counting algorithm
Photo by Possessed Photography on Unsplash

5. Quantum Entanglement

Quantum entanglement is a phenomenon in Quantum Mechanics where two or more particles are linked (entangled) and instantaneously affect each other’s state no matter how far apart in space they are.

Consider two qubits (the fundamental unit in a Quantum computer).

If two qubits are entangled, measuring the state of the first will change the value of the other.

Two entangled qubits are represented by Bell’s state, as follows:

|Ψ⟩ = 1/√2 ( |00⟩ + |11⟩ )

The property of Entanglement is used to create Quantum gates and perform complex quantum computations.

If you are new to Quantum computing and looking to learn about it, check out my article series below:

If you’re a beginner to Python or Machine Learning, check out my books below:

Level Up Coding

Thanks for being a part of our community! Before you go:

🚀👉 Join the Level Up talent collective and find an amazing job

Programming
Software Development
Software Engineering
Technology
Tech
Recommended from ReadMedium