You are on page 1of 16

Information Search and Analysis Skills

(ISAS)

SMART HOME

Written By:
Muhammad Akmal Ardhia
Ragiliawan putra rencana
Class:
TI 3SE1

Faculty:
Mr. Muhammad Riza Iqbal

Continuing Education Center for Computing and Information Technology


Faculty Of Engineering, University of Indonesia
2022
Preface

Honor the writer for the presence of God Almighty because, for his dignity and
guidance, the writer can complete this paper entitled “Process Synchronization.” Moreover,
the writer wanted to express thanks to those who had guided and helped us to complete the
task, because with their help we corrected the errors that made the paper better. This paper is
presented to complete the Information Search and Analysis Skill (ISAS) assignment. This
paper is expected to be able to deliver insights and information about process synchronization
that are valuable for writers as well as for readers.

Hopefully, through the explanation in this paper, readers can gain insight. We also
hope this paper can deliver little knowledge about process synchronization right and
absolutely. If there is any error or flaw in this paper, we apologize and will correct it in the
next isas writing. The author is open to constructive criticism.

Depok, November 2022

Writer

i
Table of Contents

Preface.........................................................................................................................................i
Table of Contents.......................................................................................................................ii
Table of Figure..........................................................................................................................iii
CHAPTER I...............................................................................................................................1
INTRODUCTION......................................................................................................................1
1.1 Background.......................................................................................................................1
1.2 Writing Objective.............................................................................................................1
1.3 Problem Domain...............................................................................................................1
1.4 Writing Methodology..................................................................................................2
1.5 Writing Framework..........................................................................................................2
CHAPTER II..............................................................................................................................3
BASIC THEORY.......................................................................................................................3
2.1. Definition of Process synchronization.........................................................................3
2.2. How Process synchronization works...........................................................................3
2.3. Section of program......................................................................................................4
CHAPTER III.............................................................................................................................5
PROBLEM ANALYSIS............................................................................................................5
3.1 Critical Section Problem..............................................................................................5
3.1.1 Rules for Critical Section.....................................................................................5
3.1.2 Solutions to the Critical Section...........................................................................5
3.2 Race Condition............................................................................................................8
CHAPTER IV............................................................................................................................9
CONCLUSION AND SUGGESTION......................................................................................9
4.1. Conclusion...................................................................................................................9
4.2. Suggestions..................................................................................................................9
BIBLIOGRAPHY....................................................................................................................10

ii
iii
Table of Figure
Figure 2. 1 Imaginary of process synchronization (REF: https://www.guru99.com/process-
synchronization.html)..........................................................................................................................5

iv
CHAPTER I

INTRODUCTION
1.1 Background
In an increasingly digital age, the concept of a smart home has emerged as
one of the most prominent trends in household technology. Smart homes combine
modern technology with user convenience to create a more intelligent and
efficient living environment. This chapter serves as an introductory guide to
understanding the fascinating world of smart homes, exploring the evolution,
benefits, and the transformative potential they hold in our daily lives.

1.2 Writing Objective


The purpose of this paper writing, as follows:

1. design and develop a user-friendly smart home system: This objective


focuses on creating a smart home system that is easy for homeowners to use,
emphasizing user experience and interface design.
2. To improve energy efficiency in residential buildings through smart home
automation: This objective aims to reduce energy consumption and greenhouse
gas emissions by implementing energy-saving technologies and automation in
smart homes.
3. To enhance home security and safety through smart home technology: This
objective concentrates on utilizing smart devices such as security cameras,
sensors, and alarms to improve home security and safety measures.

5
1.3 Problem Domain

he problem domain in the context of smart homes encompasses various challenges, issues,
and considerations that researchers, developers, and homeowners may encounter when
implementing, using, or expanding smart home technology. Here are some key problem
domains in the field of smart homes:

1 Privacy and Data Security: Smart home devices often collect sensitive data about
residents' activities, raising concerns about data privacy and security breaches. Ensuring
that data is securely stored and transmitted is a significant challenge.

2 Interoperability: Smart home devices are manufactured by different companies, often


using different communication protocols. Ensuring seamless interoperability between
devices from different manufacturers is a common problem.

3 Complexity and Usability: Smart home systems can be complex to set up and use.
Ensuring that the technology is user-friendly, especially for individuals who may not be
tech-savvy, is an ongoing challenge.

6
7

3.4Writing Methodology
1. Research Design
This research adopts a mixed-methods approach, combining both qualitative
and quantitative research methods to comprehensively explore various
aspects of smart home technology. The study encompasses the following key
components:

1.1 Literature Review


A comprehensive review of relevant academic literature, industry reports,
and existing smart home technologies will be conducted to establish a solid
theoretical foundation and identify gaps in current knowledge.

1.2 Survey and Questionnaires


Structured surveys and questionnaires will be administered to homeowners
and users of smart home systems to gather insights into their experiences,
preferences, and challenges associated with smart home technology.

1.3 Case Studies


Several real-world smart home case studies will be conducted, involving the
installation and monitoring of smart home devices and systems in different
residential settings. These case studies will provide valuable data on the
practical implementation and usability of smart home technology.
CHAPTER II

BASIC THEORY

2.1. Definition of Process synchronization


Based on synchronization, processes categorized into one of the
following two types:
Independent Process :
The one-process execution doesn't affect the execution of other processes.
Cooperative Process :
Two processes are cooperative if the execution of one process affects the
execution of another process. These processes need to be synchronized so that
the order of execution still executed.
Process synchronization problem arises in the case of Cooperative processes
also because resources are shared in Cooperative processes.
Process synchronization is a computer activity coordinating the execution to
maintain no two processes have access to the same shared data and resources
in an operating system. It manages the consistency of the data by operating
variables or hardware, so only one process can change something in the shared
memory at a time.

2.2. How Process synchronization works


Because the writers see it quite hard to explain in words, then we
explain it by example. For example, we have the first process of changing data
in a memory location. Meanwhile, the second process reads data from the
same memory location. It will create a high chance that the second process
will read inconsistent data and will error.

So, process synchronization works the process one by one, and the
computer will begin the first process, then after the first process got executed,
the second process will get worked on because only one process can get
executed at a detailed time.

So, if the first process changes the data computer will work on it first.
After it is completed, the computer will let the second process read the data
that
3
4

has been changed in the first process. It will repeat similarly like that until all
processes have been executed.

Process synchronization will prevent the dead lock because with


process synchronization, process will running one by one. Note : Deadlock is
condition when process wait endlessly for accessing resource while requested
resource is being used by another process that is waiting for other resource.

Imaginary of process synchronization

Write Read
First Process Data Second Process

Memory
Figure 2. 1 Imaginary of process synchronization (REF:
https://www.guru99.com/process-synchronization.html)

2.3. Section of program


There are four essential elements of the critical section :
 Entry Section: It is part of the process which decides the entry of a particular
process.
 Critical Section: This part permits one process to enter and modify the shared
variable (same memory location).
 Exit Section: The exit section allows the other process staying in the Entry
Section, to enter into the Critical Sections. It also scans that a process that
ended its execution should be removed through this Section.
 Remainder Section: All other parts of the Code, which is not in the Critical,
Entry, and Exit Section, stand known as the Remainder Section.
5

CHAPTER III

PROBLEM ANALYSIS
3.1 Critical Section Problem
A critical section is a segment of code which can be accessed by a signal process
at a specific point of time. The section consists of shared data resources that required to
be accessed by other processes.
In the critical section, only a single process can be executed. Other processes,
waiting to execute their critical section, need to wait until the current process completes
its execution.

3.1.1 Rules for Critical Section


The critical section need to must enforce all three rules:
 Mutual Exclusion : Mutual Exclusion is a special type of binary semaphore
which is used for controlling access to the shared resource. It includes a
priority inheritance mechanism to avoid extended priority inversion problems.
Not more than one process can execute in its critical section at one time.

 Progress : This solution is used when no one is in the critical section, and
someone wants in. Then those processes not in their reminder section should
decide who should go in, in a finite time

 Bound Waiting : When a process makes a request for getting into critical
section, there is a specific limit about number of processes can get into their
critical section. So, when the limit is reached, the system must allow request to
the process to get into its critical section.

3.1.2 Solutions to the Critical Section


The critical section run an important role in Process Synchronization so the problem
must be solved.
Some widely used method to solve the critical section problem are as follows :

3.1.2.1 Peterson Solution


This is widely used and software-based solution to critical section
problems. Peterson's solution was developed by a computer scientist Peterson
that's why it is named so.

With the help of this solution whenever a process is executing in any critical
state, then the other process only executes the rest of the code, and opposite
can happen. This method also helps to make sure that only a single process
runs in the critical section at a specific time.

5
6

Example :
PROCESS Pi
FLAG[i] = true
while( (turn != i) AND (CS is !free) ){ wait;
}
CRITICAL SECTION FLAG[i] = false
turn = j; //choose another process to go to CS

 Assume there are N processes (P1, P2, … PN) and every process at some
point of time requires to enter the Critical Section

 A FLAG[] array of size N is maintained which is by default false. So,


whenever a process requires to enter the critical section, it has to set its flag
as true. For example, If Pi wants to enter it will set FLAG[i]=TRUE.

 Another variable called TURN indicates the process number which is


currently wating to enter into the CS.

 The process which enters into the critical section while exiting would
change the TURN to another number from the list of ready processes.

 Example: turn is 2 then P2 enters the Critical section and while exiting
turn=3 and therefore P3 breaks out of wait loop.

3.1.2.2 Synchronization Hardware


Multiple operating systems have provided the hardware to solve the
critical code. The critical code can be solved with a single processor but it can
be done if we prevent the disturbance that appears when a shared resource is
being changed.

In this way, the order of instructions/process will be executed


sequentially. However, it does not apply to multiprocessors because this will
be causing a time-wasting. After all, the message of the completed
instruction/process must be delivered to all processors.

The message transmission will delay the instructions/process for entry


to the entry section and system efficiency goes down.

3.1.2.2.1 Mutex Locks


As synchronization of hardware is not easy to do, there is a method of
synchronization software known as Mutex Locks

The way it works is to LOCK shared resources into executing the


critical section's instructions, once completed and the command to exit section
then the LOCK will be removed and the next process will exit the wait
7

function/loop. Because the resource is locked up in the critical section, so no


other process can access the resource.

3.1.2.2.2 Semaphore Solution


Semaphore is another solution to the critical section. A semaphore is a
signaling mechanism with a thread that is waiting on a semaphore that will be
signaled by another thread. This is different than a mutex as the mutex can
only be signaled by the thread that is named the wait function.

A semaphore operates two atomic operations, wait and signal for


process synchronization. A Semaphore is an integer variable, accessible only
with two operations wait() and signal().

There are two kinds of semaphores: Binary Semaphores and Counting


Semaphores :
 Binary Semaphores :
They can only be either 0 or 1. They are also known as mutex
locks, as the locks can deliver mutual exclusion. All the processes can
share the same mutex semaphore which has a value of 1.

Then, a process has to wait until the lock becomes 0. Then, the
process can make the mutex semaphore value of 1 and start its critical
section. When the critical section is completed, it can reset the value of the
mutex semaphore to 0. And some other processes can enter its critical
section.

 Counting Semaphores:
They can have any value and are not bound to a certain domain.
They used to manage access to a resource that has a limitation on the
number of simultaneous accesses. The semaphore can be initialized to
the number of instances of the resources.

Whenever a process wants to use the resource, it checks if the


number of remaining instances is more than zero, i.e., the process has
an instance available. Then, the process can enter its critical section by
decreasing the value of the counting semaphore by 1.

After the process is over with the use of the instance of the
resource, it can leave the critical section by adding 1 to the number of
available instances of the resource.
8

3.2 Race Condition


Is a condition when more than one process is executing the same code or
accessing the same memory or any shared variable, in that condition there is a
possibility that the output or the value of the shared variable is wrong. So all the
processes doing the race to say that my output is correct, this condition known as a
race condition.

Several processes access and process the manipulations over the same data
concurrently, then the outcome relies on the particular order in which the access takes
place. A race condition is a condition that may appear inside a critical section. This
happens when the result of multiple thread execution in the critical section differs
according to the order in which the threads execute.

Race conditions in critical sections can be avoided if the critical section is


treated as an atomic instruction (run independently). Also, proper thread
synchronization utilizing locks or atomic variables can prevent race conditions.
CHAPTER IV

CONCLUSION AND SUGGESTION


4.1. Conclusion
Processes Synchronization or Synchronization is the task by which
processes that share the same memory space are managed in an operating system.
It helps maintain the consistency of data by using variables or hardware so no two
processes can have access to the same shared data and resources.

It will help us to make a priority for the process because it can only run
one processes at a time and helped us to reduce the posibillity process read or
write an inconsistency data because to much procesess. And it regulates the
process so it goes in sequence as we command it first.

4.2. Suggestions
Like we know in this paper, there are several method to solve problem in
process synchronization like Peterson solution’s, Synchronization hardware,
Mutex Locks, and Semaphores. This several method will help us to solve critical
section problem, and make process synchronization run well again.

We guess process synchronization is a good operation in operating system,


because it prevent the computer to read or change an inconsistency data and make
us works better with consistent data also make we work efficiently.

9
BIBLIOGRAPHY

geeksforgeeks.org/introduction-of-process-synchronization/. Retrieved from geeksforgeeks.org:


https://www.geeksforgeeks.org/introduction-of-process-synchronization/ [25/11/2022]

Guru99. Guru99. Retrieved from guru99.com: https://www.guru99.com/process-synchronization.html#3


[24/11/2022]

studytonight.com/operating-system/process-synchronization. Retrieved from studytonight.com:


https://www.studytonight.com/operating-system/process-synchronization [24/11/2022]

10

You might also like