Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
P
PP-03-Synchronization
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohamadbashar.disoki
PP-03-Synchronization
Commits
49282f9a
You need to sign in or sign up before continuing.
Commit
49282f9a
authored
Nov 10, 2023
by
Mohamad Bashar Desoki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Memory inconsistency
parent
2270cd63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
11 deletions
+54
-11
workspace.xml
.idea/workspace.xml
+25
-11
README.md
README.md
+1
-0
MemoryConsistencyErrorExample.java
src/main/java/MemoryConsistencyErrorExample.java
+28
-0
No files found.
.idea/workspace.xml
View file @
49282f9a
...
@@ -4,16 +4,10 @@
...
@@ -4,16 +4,10 @@
<option
name=
"autoReloadType"
value=
"SELECTIVE"
/>
<option
name=
"autoReloadType"
value=
"SELECTIVE"
/>
</component>
</component>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"c46989a2-1428-4d1f-9b45-864f22943ab6"
name=
"Changes"
comment=
""
>
<list
default=
"true"
id=
"c46989a2-1428-4d1f-9b45-864f22943ab6"
name=
"Changes"
comment=
"Thread interference"
>
<change
afterPath=
"$PROJECT_DIR$/.gitignore"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/main/java/MemoryConsistencyErrorExample.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/encodings.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/misc.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/README.md"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/README.md"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/vcs.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/README.md"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/pom.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/main/java/Counter.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/main/java/RaceConditionExample.java"
afterDir=
"false"
/>
</list>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
@@ -46,7 +40,14 @@
...
@@ -46,7 +40,14 @@
"SHARE_PROJECT_CONFIGURATION_FILES": "true"
"SHARE_PROJECT_CONFIGURATION_FILES": "true"
}
}
}]]>
</component>
}]]>
</component>
<component
name=
"RunManager"
>
<component
name=
"RunManager"
selected=
"Application.MemoryConsistencyErrorExample"
>
<configuration
name=
"MemoryConsistencyErrorExample"
type=
"Application"
factoryName=
"Application"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"MemoryConsistencyErrorExample"
/>
<module
name=
"Synchronization"
/>
<method
v=
"2"
>
<option
name=
"Make"
enabled=
"true"
/>
</method>
</configuration>
<configuration
name=
"RaceConditionExample"
type=
"Application"
factoryName=
"Application"
temporary=
"true"
nameIsGenerated=
"true"
>
<configuration
name=
"RaceConditionExample"
type=
"Application"
factoryName=
"Application"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"RaceConditionExample"
/>
<option
name=
"MAIN_CLASS_NAME"
value=
"RaceConditionExample"
/>
<module
name=
"Synchronization"
/>
<module
name=
"Synchronization"
/>
...
@@ -56,6 +57,7 @@
...
@@ -56,6 +57,7 @@
</configuration>
</configuration>
<recent_temporary>
<recent_temporary>
<list>
<list>
<item
itemvalue=
"Application.MemoryConsistencyErrorExample"
/>
<item
itemvalue=
"Application.RaceConditionExample"
/>
<item
itemvalue=
"Application.RaceConditionExample"
/>
</list>
</list>
</recent_temporary>
</recent_temporary>
...
@@ -69,6 +71,14 @@
...
@@ -69,6 +71,14 @@
<option
name=
"presentableId"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1699638681976
</updated>
<updated>
1699638681976
</updated>
</task>
</task>
<task
id=
"LOCAL-00001"
summary=
"Thread interference"
>
<created>
1699642277693
</created>
<option
name=
"number"
value=
"00001"
/>
<option
name=
"presentableId"
value=
"LOCAL-00001"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1699642277693
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"2"
/>
<servers
/>
<servers
/>
</component>
</component>
<component
name=
"Vcs.Log.Tabs.Properties"
>
<component
name=
"Vcs.Log.Tabs.Properties"
>
...
@@ -82,4 +92,8 @@
...
@@ -82,4 +92,8 @@
</map>
</map>
</option>
</option>
</component>
</component>
<component
name=
"VcsManagerConfiguration"
>
<MESSAGE
value=
"Thread interference"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"Thread interference"
/>
</component>
</project>
</project>
\ No newline at end of file
README.md
View file @
49282f9a
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
*
Thread Synchronization
*
Thread Synchronization
*
Race Condition
*
Race Condition
*
Critical Section
*
Critical Section
*
Memory inconsistency
*
*
*
Locks and Atomic Variables
*
Locks and Atomic Variables
...
...
src/main/java/MemoryConsistencyErrorExample.java
0 → 100644
View file @
49282f9a
public
class
MemoryConsistencyErrorExample
{
private
static
boolean
sayHello
=
false
;
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
Thread
thread
=
new
Thread
(()
->
{
while
(!
sayHello
)
{
}
System
.
out
.
println
(
"Hello World!"
);
while
(
sayHello
)
{
}
System
.
out
.
println
(
"Good Bye!"
);
});
thread
.
start
();
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
"Say Hello.."
);
sayHello
=
true
;
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
"Say Bye.."
);
sayHello
=
false
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment