Skip to content

Commit 9f294a7

Browse files
committed
Rename concurrency to synchronozation and remove whitespaces
1 parent fcd0985 commit 9f294a7

File tree

10 files changed

+11
-24
lines changed

10 files changed

+11
-24
lines changed

Operating-System-Concepts/memory-management/aligned_malloc_free/aligned_mem.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ void* aligned_malloc(size_t bytes, size_t alignment)
3737
return p2;
3838
}
3939

40-
#endif
40+
#endif

Operating-System-Concepts/memory-management/aligned_malloc_free/test.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ gcc -I$(pwd) mymalloc.c test.c
66
77
* Memory Leak check
88
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose a.out
9-
109
*/
1110

1211
#include <stdio.h>
@@ -16,5 +15,5 @@ void main()
1615
{
1716
int *p = (int *)aligned_malloc(50, 128);
1817
printf("Allocate aligned memory at : %p\n", p);
19-
// aligned_free(p);
18+
aligned_free(p);
2019
}

Operating-System-Concepts/memory-management/my_malloc_free/mymalloc.c

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <stddef.h>
55
#include "mymalloc.h"
66

7-
87
char memory[MAX_MEMSIZE];
98

109
struct block* freeList = (void *)memory;
@@ -65,7 +64,6 @@ void* myMalloc(size_t bytes)
6564
}
6665
}
6766

68-
6967
void merge()
7068
{
7169
struct block* prev = NULL;

Operating-System-Concepts/memory-management/my_malloc_free/mymalloc.h

-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
#define MAX_MEMSIZE 20000
1010

11-
12-
1311
typedef struct block
1412
{
1513
size_t size;
@@ -27,5 +25,4 @@ void merge();
2725

2826
void myFree(void* ptr);
2927

30-
3128
#endif

Operating-System-Concepts/memory-management/my_malloc_free/test.c

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
gcc -I$(pwd) mymalloc.c test.c
66
*/
77

8-
98
#include <stdio.h>
109
#include "mymalloc.h"
1110

Operating-System-Concepts/concurrency/SimpleProducerConsumer.cpp renamed to Operating-System-Concepts/synchronization/SimpleProducerConsumer.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void consumeData(int data)
2323
std::cout << "[CONSUMER] : consumed data : " << data << "\n";
2424
}
2525

26-
void producerFunc()
26+
void consumerFunc()
2727
{
2828
while (true) {
2929
while (!g_ready) {
@@ -35,7 +35,7 @@ void producerFunc()
3535
}
3636
}
3737

38-
void consumerFunc()
38+
void producerFunc()
3939
{
4040
while (true) {
4141
std::unique_lock<std::mutex> ul(g_mutex);
@@ -60,4 +60,4 @@ int main()
6060
producerThread.join();
6161

6262
return 0;
63-
}
63+
}

Operating-System-Concepts/concurrency/SimpleProducerConsumerCond.cpp renamed to Operating-System-Concepts/synchronization/SimpleProducerConsumerCond.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ int main()
6868
producerThread.join();
6969

7070
return 0;
71-
}
71+
}

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ Short sample program to demonstrate C++ language basics
3939

4040

4141
# [Operating System Concepts](Operating-System-Concepts/)
42-
* Concurrency
43-
* Simple producer consumer with busy wait [Link](Operating-System-Concepts/concurrency/SimpleProducerConsumer.cpp)
44-
* Simple producer consumer with **condition variable** [Link](Operating-System-Concepts/concurrency/SimpleProducerConsumerCond.cpp)
42+
* Synchronization
43+
* Simple producer consumer with busy wait, mutex in C++ [Link](Operating-System-Concepts/synchronization/SimpleProducerConsumer.cpp)
44+
* Simple producer consumer with **condition variable**, condition variable in C++ [Link](Operating-System-Concepts/synchronization/SimpleProducerConsumerCond.cpp)
4545
* File IO
4646
* Print all lines which contain a given pattern [Link](Operating-System-Concepts/fileio/SearchPatternInFile.cpp)
4747
* Memory Management

problems/others/MaxLengthForCutting.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#include <algorithm>
55
#include <vector>
66

7-
8-
bool isValid(std::vector<int>& wood, const int K,
9-
const int len)
7+
bool isValid(std::vector<int>& wood, const int K, const int len)
108
{
119
int count = 0;
1210

@@ -26,7 +24,6 @@ int findMaxLengthCut(std::vector<int>& wood, int K)
2624
int left = 1;
2725
int right = *max_element(wood.begin(), wood.end());
2826

29-
3027
while (left <= right) {
3128
int mid = left + (right - left) / 2;
3229

@@ -37,7 +34,6 @@ int findMaxLengthCut(std::vector<int>& wood, int K)
3734
}
3835
}
3936

40-
4137
return left;
4238
}
4339

problems/others/MergeTransactions.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <queue>
55
#include <vector>
66

7-
87
class Node
98
{
109
public:
@@ -53,7 +52,7 @@ std::vector<int> mergeSheet(std::vector<std::vector<int>>& transactions)
5352
maxq.push(node);
5453
}
5554

56-
while(!maxq.empty()) {
55+
while (!maxq.empty()) {
5756
Node current = maxq.top();
5857
maxq.pop();
5958

@@ -70,7 +69,6 @@ std::vector<int> mergeSheet(std::vector<std::vector<int>>& transactions)
7069
}
7170

7271
return merged;
73-
7472
}
7573

7674
int main()

0 commit comments

Comments
 (0)