Friday, July 24, 2020

The blind boy!

The blind boy! A blind boy sat on the steps of a building with a hat by his feet. He held up a sign which said: “I am blind, please help.”There were only a few coins in the hat. A man was walking by. He took a few coins from his pocket and dropped them into the hat. He then took the sign, turned it around, and wrote some words. He put the sign back so that everyone who walked by would see the new words.Soon the hat began to fill up. A lot more people were giving money to the blind boy. That afternoon the man who had changed the sign came to see how things were.The boy recognized his footsteps and asked, “Were you the one who changed my sign this morning? What did you write?”The man said, “I only wrote the truth. I said what you said but in a different way.”What he had written was: “Today is a beautiful day and I cannot see it.”Do you think the first sign and the second sign were saying the same thing?Of course both signs told people the boy was blind. But the first sign simply said the boy was blind. The second sign told people they were so lucky that they were not blind. Should we be surprised that the second sign was more effective?Moral of the story: Be thankful for what you have. Be creative. Be innovative. Think differently and positively.Invite others towards good with wisdom. Live life with no excuse and love with no regrets. When life gives you a 100 reasons to cry, show life that you have 1000 reasons to smile. Face your past without regret. Handle your present with confidence. Prepare for the future without fear. Keep the faith and drop the fear.Great men say, “Life has to be an incessant process of repair and reconstruction, of discarding evil and developing goodness…. In the journey of life, if you want to travel without fear, you must have the ticket of a good conscience.”The most beautiful thing is to see a person smiling… And even more beautiful is, knowing that you are the reason behind it!!!Author Unknown

Friday, May 22, 2020

An Analysis Of Ken Kesey s One Flew Over The Cuckoo s...

While One Flew Over the Cuckoo’s Nest is only a little over fifty years old, it feels like an even more dated story then some things written hundreds of years ago. This is because it is set in a field, psychology, that is constantly evolving and makes drastic progress in short amounts of time. The sexist and racist undertones coupled with the outdated view of psychology dates the book and undercuts the theme of the story. Psychology is the study of the human mind and behavior. It is only roughly two hundred years old, but there have been tremendous strides since the days of Sigmund Freud. Ken Kesey’s novel takes place in a mental hospital in 1962. His goal with this story was to express his thoughts on the world around him and tell†¦show more content†¦A person is put in there so they are not a danger to themselves or anyone else. The quiet room is not some big, bad punishment either. Sometimes people like to be in there when they need to calm down and do not b e disturbed. Most likely, McMurphy would have been banned to his room for a few days or possibly as long as his visit, depending on the severity of his bad deed. One of the more notable differences between the ward in this book and modern day wards would be the rooms. In the book, all the men sleep in one big room. There is no privacy and they have to see each other all day, every day. This simply would not happen now. People have individual rooms because that gives people a sense of security. Say if someone felt anxious and they needed to be away from everyone else, they would not be able to in this book and that could be detrimental to their mental health. The biggest difference between reality and this book, is the group therapy sessions. The way that Nurse Ratched runs the sessions is very antagonizing. She chooses one person to attack and for the hour that all the men are gathered in that room she has them all tear apart that person. She finds their one weakness or the reason t hey are in the hospital and targets them. Ordinarily, these group therapy sessions, which happen three times a day not once, would be on a volunteer basis. If someone does not want to talk, they would not have too. The only exception wouldShow MoreRelatedAnalysis Of One Flew Over The Cuckoo s Nest By Ken Kesey1226 Words   |  5 Pagescontent more interesting. The novel, One Flew Over the Cuckoo’s Nest, written by, Ken Kesey, contains several literary theories that made the classic story successful. The storyline was interesting enough for it to be turned into a movie and an altered version Broadway play. At one point Time Magazine included this novel into its top one hundred novels list. What made this book so fascinating to read and successful was the use of several literacy theories. One of the main literacy theories presentRead MoreAnalysis Of One Flew Over The Cuckoo s Nest By Ken Kesey1622 Words   |  7 Pagesor someone. Leadership on the other hand, may be a tool us ed to overcome authority which is depicted when McMurphy is admitted into the ward and effectively changes the patient’s lives for the better. Throughout the novel, One Flew over the Cuckoo’s Nest, written by Ken Kesey, McMurphy’s leadership dominates Nurse Ratched’s authority due to his success in transforming the patients into better people from the second of his arrival and giving them the option to live a better life. McMurphy, a gamblerRead MoreAnalysis Of One Flew Over The Cuckoo s Nest By Ken Kesey1498 Words   |  6 Pagesdevelopment of patients of the psychological institution of the book One Flew Over The Cuckoo’s Nest by Ken Kesey. The patients in the psychic ward each demonstrates different characteristics that corresponded to fixation from each stage of development through daily activity and the way that they present themselves. It also illustrates societal stereotype to these fixation and lead to unhealthy psychological environment to improve patient s’ internal health. The five stages of psychosexual developmentRead MoreAnalysis Of Ken Kesey s One Flew Over The Cuckoo s Nest2637 Words   |  11 Pages The Author and His/Her Times: Ken Kesey was born on September 17, 1935 and died on November 10, 2011 at age 66. Kesey was once arrested for possession of marijuana and a â€Å"faked suicide† and was put into prison for five years. He also had a lot of experimentation with psychoactive drugs, which could spark his interest in the human mind, which has a lot of influence on the novel, One Flew Over the Cuckoo’s Nest. The novel was put on The Times list of To honor Kesey after his death, there is a filmRead MoreAnalysis Of Ken Kesey s One Flew Over The Cuckoo s Nest2592 Words   |  11 Pagestreatment patients in a mental hospital received and not many people helped with that. Today, people are becoming more outspoken about mental illness, why? In Ken Kesey’s One flew over the Cuckoo’s Nest, before McMurphy enters the hospital, it was all in perfect order, everyone would talk about their experience and what went through their heads. At one time, Randle McMurphy, a new patient at the hospital speaks about his own insanity with pride, â€Å"â€Å"Don’t overlook the possibility that this man might be feigningRead MoreAnalysis Of One Flew Over The Cuckoo s Nest By Ken Kesey1195 Words   |  5 Pageseveryday life, there is always an unequal distribution of power. More often than not, someone has more power than another. For example, nurses and patients in a mental institution; the nurses have authority over the patients. In the classic novel, One Flew Over the Cuckoo’s Nest, by Ken Kesey, Nurse Ratched makes sure that all of the patients are weaker than she is. Since she is clearly the head of the ward, Nurse Ratched is able to control the patients and their actions. However, when an independentRea d MoreOne Flew Over The Cuckoos Nest Speech Act Theory Essay1281 Words   |  6 PagesKen Kesey forms the intricate relationships among the characters in the novel One Flew Over the Cuckoo’s Nest by the unique use of perspective and speech. Throughout the novel, Kesey depicts this connection between the public world and the seemingly closed off society inside the mental institution. This creates two separate spheres separated by a few walls and doors. Kesey goes on to form a unique perspective in the novel, told by a paranoid schizophrenic, with the narrator’s caricature-likeRead MoreKen Kesey s One Flew Over The Cuckoo s Nest1629 Words   |  7 Pages1962, Ken Kesey’s One Flew Over The Cuckoo’s Nest is a timeless classic. This novel has been subject to analysis through many different literary lenses: feminist, Marxist, and of course, psychoanalytic. One Flew Over The Cuckoo’s Nest provides a plethora of evidence when it comes to using the ps ychoanalytic lens. The lens in question deals with the teaching of Sigmund Freud. When reading this novel, the audience sees quite clearly that the world of psychology plays an impactful role in One Flew Over

Thursday, May 7, 2020

Britain And The American Colonies - 913 Words

There is always a difference between the ones that conquer and the ones that are conquered. In this case, Britain and the American colonies developed great gaps during time, not only religious, economical and finally cultural. The beginning of this separation between the colonists and Britain runs deep. The Britain crown didn’t invest directly in the search of colonies in the Americas and by doing so, it gave the colonist a lose rope to start developing a new vision. The colonists had little or nothing to report directly to the crown and what they reported could take months to reach Britain and even more for Britain to do something about it. The vision that Britain developed from America is the response to the vision that is created during the first years of the colony. A wild land with abundance of resources that can generate a profit to the empire. In this vision the colonies are not seen as part of the empire. It is a land that it is in the power of Britain’s to be used as they see fit. This would generate big problems in the future when the population and popularity of the colonies start to grow proportionally with the profit that the colonies generate. The fact that the Britain government did not have a strong presence in the colonies is the first step to a new mentality. Of course, the change of mentality took generations, and even when the general population respected the Britain crown, the devotion to a king that an ocean away from the started to create aShow MoreRelatedThe Relations Between Britain and Its American Colonies876 Words   |  4 Pages1754 to 1763, the French and Indian War took place. This war altered the political, economic, and ideological relations between Britain and its American colonies. It was the last of four North American wars waged from 1689 to 1763 between the British and the French. In these struggles, each country fought for control of the continent with the assistance of Native American and colonial allies. The French and Indian War occurred to end the land dispute between the British and French. Whoever won, inRead MoreThe World Of The American Colonies Of Great Britain1715 Words   |  7 Page sof this modern age have summoned you for the sake of meeting your Greatness. WS Pardon†¦ what â€Å"America† dids’t thou reference? Thou meanest the American colonies of Great Britain? RB Aye, those same former colonies. Now so long detached from your homeland of Great Britain, we are in many ways the superpower of the world. WS Preposterous! Those puny colonies, breaking free of the mighty empire of England? What trickery happened then? MD Why, there was no trickery. In an honest war, our war of independenceRead MoreThe Conflict Between Great Britain and the North American Colonies742 Words   |  3 Pagesbetween Great Britain and its thirteen North American colonies was economic in origin, in fact the American Revolution had its roots in politics and other areas of American life.† Great Britain and the American colonies had a relationship impacted with many hardships. I believe that there was a political struggle between the two groups, but that Great Britain and the American colonies used economics as a chance to show how much control they had. Multiple Acts written by Parliament, the colonies CommitteesRead MoreThe 1765 Quartering Act Was Placed On The American Colonies Of Britain1607 Words   |  7 PagesThe 1765 Quartering Act was placed on the American Colonies of Britain on March 24, 1765. It mandated that British soldiers and officers were to be accommodated in barracks in the town or city that they were situated in. The act itself stated that the town or city would be notified beforehand so as to have time to prepare for the housing of the soldiers. Under the circumstance that any officer was found to be housing on their own accord and not on the townspeople’s then that officer would then beRead MoreBritish Were Responsible For Causing The American Revolution1030 Words   |  5 PagesThe British were responsible for causing the American Revolution because they put unfair limitations on the colonies. One of Great Britain’s limits on the colonies was the Proclamation of 1763. The Proclamation of 1763 states that the colonies can not expand their reign west of the Appalachian Mountain and the Indians could not move east towards the East Cost (Hakim 36). Britain was scared that as the colonies grew in population and in power, along with the Indians and French that were in the NewRead MoreAdam Smith s The Wealth Of Nations Essay1194 Words   |  5 Pagesthe mother country’s ability to rule its colonies. They also talk about what they believe should and could lead to the political separation of the mother country and its colonies. Adam Smith’s The Wealth of Nations looked to the fact that it is impractical to control the benefits of the colonies. He hopelessly figured the cost of empire. However, he was too late to effect the British policy. He states that the countries who controlled the American colonies, which had direct trade with the East IndiesRead MoreThe American Revolution And Its Effect On American History1537 Words   |  7 PagesThe American Revolution began in 1775. Due to the Revolution 1775 proved to be one of the most productive years in American history. The American Revolution caused great changes in the original thirteen colonies that helped mold the United States into what it is today. The revolution caused changes in the original colonies’ economics, caused immense changes in slavery, and changed the society of the colonies in general. As a result of the French and Indian war Britain neglected the American coloniesRead MoreThe Battle Of The American Revolution1535 Words   |  7 PagesApril 19, 1775, tension between the American colonies and Great Britain had reached its breaking point as fighting erupted at Lexington and Concord, Massachusetts. These battles marked the beginning of the American Revolution, where the colonists sought freedom from King George III of England and Parliament. After fighting for years to gain their independence, the American colonies won the war. Even though the colonists faced several disadvantages during the American Revolution against the British, theRead MoreThe Impact of the French and Indian War on Colonial America1065 Words   |  5 PagesColonial America The French and Indian war was fought between Great Britain and France from 1754 to 1763. Also known as the Seven Year’s War, this confrontation eventually erupted into an all out worldwide conflict. Its effects were not only immediate but long term. Although the colonies were not directly tied to the war, it greatly impacted them as well as modern America. The war was primarily fought along the colonies separating New France, from Virginia to Nova Scotia. France controlled theRead MoreThe American Revolutionary War Essay1322 Words   |  6 PagesStates of America the American Revolution is called the American War of Independence but in Europe it is more commonly referred to as the American Revolutionary War. Though it is a minor terminological difference it impacts how a reader will view the war. Naming plays a large role in the perception of an event. With this said, one must also note that Sarson, though teaching in Britain, received his PhD at John Hopkins University in Baltimore. This would give Sarson an American viewpoint on many aspects

Wednesday, May 6, 2020

Argumentative Essay of the Movie “The Reader” Free Essays

Parra 1 Martin Parra Prof. Enrique Wong English 100 4 December 2012 Looks can be deceiving; do not fall into the trap â€Å"Ethical principles stand above the existence of the nation and that, by adhering to these principles an individual, belongs to the community of all those who share, who have shared, and who will share this belief† (Fromm 121). This thought was impossible to perceive in Germany during Hitler’s command and his cruel, racist, immoral Jewish holocaust. We will write a custom essay sample on Argumentative Essay of the Movie â€Å"The Reader† or any similar topic only for you Order Now Ethics and moral never existed in that country by that time, thus Germans only lived under the â€Å"law†. One special case of this atrocity was the one of Hanna Schmitz, in the movie The Reader. Some people would say that Hanna Schmitz was a right person based on the fact that she helped Michael Berg during his youth and also the fact that she was a disciplined worker. However, she manipulated Michael Berg, killed around three hundred people in the concentration camp, and killed herself when she was in jail. Despite Hanna helped Michael when he more needed at the time he was very sick, she manipulated and mistreated him in different ways. The first one and the most important was when Michael had to take a bath (The Reader, film). He wanted a private moment, but Hanna disrespected him (The Reader, film). She did not close the curtain and saw him naked. When Michael realized that, he was restrained. Looking at his eyes, Hanna seized the moment and got naked, too. Michael got shocked. After some looks, Michael was having his first sex experience (The Reader, film). He was just fifteen years old. Then, they began to repeat this situation almost every day. So, Michael Parra 2 started to prefer going Hanna’s instead going home, and she did not care about it. Neither cared about his name (she just called him â€Å"kid†) nor how was he with his disease (The Reader, film). She just wanted to have sex and pleasure, not love at all. After some time, Michael read a story to Hanna and she liked the way he did it. Hanna liked so much that she preferred hearing a story before having sex (The Reader, film). Again, Hanna is using Michael just to self-indulge. Another situation where she did not show respect for him was in the train. Both saw each other, but Hanna did not want to greet him and turned around (The Reader, film). Furthermore, she told Michael that she could not be upset with him because she did not care enough about him (The Reader, film). Unexpectedly, he asked Hanna if she loved him, the answer was a deep silence (The Reader, film). So, it is clear that Hanna Schmitz did not respect Michael Berg, just used and manipulated him for her own benefit. After a long time, Michael became a law student and saw Hanna again, but in a trial (The Reader, film). It resulted that Hanna drop her job at the train office and radically became a concentration camp guard (The Reader, film). Why did she take that decision? It can be possible that she was in a difficult situation in her life, but she could have easily chosen another type of job, not an atrocious one. Even though she knew her new job was killing people without a logic reason, she accepted before thinking twice. The worst thing she did was burning a church with three hundred people inside and locking all the doors (The Reader, film). Where are the ethics, moral and logic here?! She did not want to think in the most important values and rights, she just obeyed the law. Based on Donald B. Walker article: Law is the derivation of a society? interpretation of justice which is relative both to time and place. Furthermore, the creation of law is more frequently the Parra 3 result of the interpretation of justice by the powerful in the society which is then applied at the expense of the powerless. Obviously, in this case the Germans were the powerful and Jews, the powerless. Consequently, their law was an interpretation of what they think to be justice; but, that justice was based on hate, racism and killing of some people, especially Jews. This absurd law was the only thing Hanna had in my mind when she was working as a concentration camp guard. She could save those people if she had thought in ethics and rights, but no. She did not open her mind, just obeyed the law. At the end of the trial Michael began to cry because the judge sentence Hanna penal servitude for life because she admitted that the letter about those killed people in the concentration camp was written by her (The Reader, film). It may have been worse; she could have been executed due to all the people she had killed. Years passed, Michael Berg became a judge, he had a daughter; but, he never stopped thinking about Hanna Schmitz. He could not forget her. So, one day he decided to write a letter to her (The Reader, film). When she received it and heard the name Michael Berg, she was surprised. After that, Michael sent her a story recorded in a cassette. Since then, plenty of cassettes arrived to Hanna’s jail (The Reader, film). Since then, she learned how to read and write. Now the big question, why did she tell the judge that she wrote that letter when she did not know how to write? It cannot be possible that Hanna lied in the most decisive moment of the trial, of her future. Finally, she killed herself after Michael wanted to help to her to get out of prison. These attitudes are considered part of the psychologically weakest people who refuse any kind of help from others who love and care them. Once again Hanna Schmitz hurt Michael and did not want his help, even worse, his love. Parra 4 In spite of Hanna Schmitz helped the young boy Michael Berg when he was sick and was an excellent worker, as a conclusion, it is clear that she was a manipulating and cruel person. She used the young boy Michael Berg to satisfy herself and killed a lot of people just because it was her job. She did not showed respect, human rights, and ethics in both cases. Actually, she can be considered a selfish hypocrite prepotent person who just wanted her own benefit with no respect or care about the others around her. So, be careful; you do not want to be like Hanna Schmitz, right? Works Cited Fromm, Erich. Escape from freedom. New York: Farrar and Rinehart, 1941. Print. The reader. Dir. Stephen Daldry. Perf. Kate Winslet, Ralph Fiennes, and Bruno Ganz. Mirage, 2008. Film. Walker, Donal B. The Detah Penalthy: Legal Cruelty. USA Today, November 1983. How to cite Argumentative Essay of the Movie â€Å"The Reader†, Essay examples

Monday, April 27, 2020

Pay to Play When Is It Time to Use Paid Promotion

In a perfect world, great content alone would be enough for you to reach your content marketing goals. Fresh, engaging content would stand out in the crowd and get all the attention it deserves. Unfortunately, real-life content marketing doesn’t always work that way. The online landscape is saturated with rapidly-increasing amounts of valuable content and there’s only so much information that people can consume. Free Actionable Bonus: Free Actionable Bonus: Want to create better content for social media? Get the complete guide to building a social media strategy and creating content for social, plus 6 awesome examples to inspire your next post. You can take the slow and steady route to organically grow your audience with great content. But with supply often outpacing demand, even high-quality content can slip through the cracks. So, how do you get a competitive edge when there is so much content being produced? Paid promotion might be one answer. Understanding Paid Promotion Before diving too deeply into the nuts and bolts of paid content promotion, it’s important to make the distinction between paid and organic promotion. There are many organic channels for content promotion that can help boost your visibility: SEO techniques Social media Influencer marketing Webinars and other live events Word-of-mouth While these organic promotion methods don’t involve spending any money, they do require a fair amount of creativity, effort and perseverance. Customizing for your target audience can also be more difficult with organic promotion strategies. That’s why paid content promotion can serve as a valuable complement to your existing organic promotion strategy. The concept of paid promotion isn’t new. In fact, a SocialBakers study from 2013 showed that even then, 77% of Facebook pages were relying on paid traffic for promotion. Facebook: This channel remains the top choice among marketers for paid promotion because of the excellent targeting capabilities and broad reach. LinkedIn: This networking platform offers some great paid-promotion options for marketers, especially in the B2B realm. LinkedIn has proven to generate more leads for B2B businesses than Twitter, Facebook or blogs. Pinterest: If your business produces some great visuals, Promoted Pins can be an effective way to get you seen by a wider audience. Twitter: You might not have thought of Twitter as a paid-promotion channel, but the platform presents some valuable opportunities. Research shows that 74% of consumers follow brands on Twitter to receive updates and promoted tweets ensure that your content is reaching the most qualified audience. Outbrain: The Outbrain platform allows you to promote your content as â€Å"recommended articles† on other websites. Similar content-discovery networks include Taboola and LinkWithin. Search engine advertising: Search ads allow for laser-focused targeting and offer options for virtually any budget. Not only does paid promotion require little manual effort in comparison to organic methods, but it also allows you to present your content to a highly-targeted audience. Is It Worth It? Even marketers who are enthusiastic about the benefits of paid promotion may have some lingering concerns about the cost. How can you make sure you’re maximizing ROI and not wasting money? The best way to ensure that you’re squeezing the most value out of your paid promotions is to do your research before you jump in. Analyze the performance of your organic content promotion and use the data to identify content that would make the best candidates for paid promotion. When it comes to ROI, having clear goals is key. Identify and track the KPIs associated with your goals to see if you’re getting the needed bang for your paid-promotion buck. If you’ve been struggling to boost your visibility with your target audience, paid content promotion may be a way to give you a boost. It can help you cut through the noise and actually reach the people you need to turn into customers. Not all paid promotion platforms are costly, and the ROI they can generate can make the cost worthwhile.

Thursday, March 19, 2020

Free Essays on Hitchhikers Guide To The Galaxy

In â€Å"The Hitchhikers Guide to the Galaxy† by Douglas Adam, the main character’s, Arthur Dent, main conflict was that he was placed into a foreign situation with no idea of what to do. But first to describe Arthur Dent, he is a British man with seemingly dim wit in the beginning of the book, but this is mostly due to his own confusion. Arthur’s best friend Ford Prefect comes to tell him of the impending doom laid upon the Earth, but Mr. Dent is preoccupied with the task of warding a bulldozer away from demolishing his home. His friend, Mr. Prefect, tells him about the plans for the destruction of the Earth due to the building of an intergalactic bypass, which is ironic for that was the same reason his house was being demolished on the Earth that now laid in ruins. But because of Arthur’s friend he was on of very few survivors, but now they were held on a ship belonging to the very aggressive race of aliens known as the Vogons. With no knowledge of these people, Mr. Dent has been put in an unfortunate position. Although Arthur Dent had no prior knowledge of the universe, or the different alien races that inhabit it, he was fortunate in one respect he had an indispensable resource in his friend and his electronic book, â€Å"The Hitchhikers Guide to the Galaxy.† After a short while from being transported onto the Vogon war ship, Mr. Prefect showed Arthur how to operate the book. With this he could learn all he would possible need to know in order to avoid death in the hands of the Vogons. With his friend he had one of the people who contributed to the creation of â€Å"The Hitchhikers Guide to the Galaxy.† Thanks to his friendship with Mr. Prefect, he was able to learn about the most deadly weapon in the Vogon’s arsenal, the reading of their poetry aloud. Thanks to this information provided by his friend, and the book he carried, he would be able to avoid death by the Vogons.... Free Essays on Hitchhikers Guide To The Galaxy Free Essays on Hitchhikers Guide To The Galaxy In â€Å"The Hitchhikers Guide to the Galaxy† by Douglas Adam, the main character’s, Arthur Dent, main conflict was that he was placed into a foreign situation with no idea of what to do. But first to describe Arthur Dent, he is a British man with seemingly dim wit in the beginning of the book, but this is mostly due to his own confusion. Arthur’s best friend Ford Prefect comes to tell him of the impending doom laid upon the Earth, but Mr. Dent is preoccupied with the task of warding a bulldozer away from demolishing his home. His friend, Mr. Prefect, tells him about the plans for the destruction of the Earth due to the building of an intergalactic bypass, which is ironic for that was the same reason his house was being demolished on the Earth that now laid in ruins. But because of Arthur’s friend he was on of very few survivors, but now they were held on a ship belonging to the very aggressive race of aliens known as the Vogons. With no knowledge of these people, Mr. Dent has been put in an unfortunate position. Although Arthur Dent had no prior knowledge of the universe, or the different alien races that inhabit it, he was fortunate in one respect he had an indispensable resource in his friend and his electronic book, â€Å"The Hitchhikers Guide to the Galaxy.† After a short while from being transported onto the Vogon war ship, Mr. Prefect showed Arthur how to operate the book. With this he could learn all he would possible need to know in order to avoid death in the hands of the Vogons. With his friend he had one of the people who contributed to the creation of â€Å"The Hitchhikers Guide to the Galaxy.† Thanks to his friendship with Mr. Prefect, he was able to learn about the most deadly weapon in the Vogon’s arsenal, the reading of their poetry aloud. Thanks to this information provided by his friend, and the book he carried, he would be able to avoid death by the Vogons....

Tuesday, March 3, 2020

Threading Introduction in Visual Basic

Threading Introduction in Visual Basic To understand threading in VB.NET, it helps to understand some of the foundation concepts. First up is that threading is something that happens because the operating system supports it. Microsoft Windows is a pre-emptive multitasking operating system. A part of Windows called the task scheduler parcels out processor time to all the running programs. These small chunks of processor time are called time slices. Programs arent in charge of how much processor time they get, the task scheduler is. Because these time slices are so small, you get the illusion that the computer is doing several things at once. Definition of Thread A thread is a single sequential flow of control. Some qualifiers: A thread is a path of execution through that body of code.Threads share memory so they have to cooperate to produce the correct result.A thread has thread-specific data such as registers, a stack pointer, and a program counter.A process is a single body of code that can have many threads, but it has at least one and it has a single context (address space). This is assembly level stuff, but thats what you get into when you start thinking about threads. Multithreading vs. Multiprocessing Multithreading is not the same as multicore parallel processing, but multithreading and multiprocessing do work together. Most PCs today have processors that have at least two cores, and ordinary home machines sometimes have up to eight cores. Each core is a separate processor, capable of running programs by itself. You get a performance boost when the OS assigns a different process to different cores. Using multiple threads and multiple processors for even greater performance is called thread-level parallelism. A lot of what can be done depends on what the operating system and the processor hardware can do, not always what you can do in your program, and you shouldnt expect to be able to use multiple threads on everything. In fact, you might not find many problems that benefit from multiple threads. So, dont implement multithreading just because its there. You can easily reduce your programs performance if its not a good candidate for multithreading. Just as examples, video codecs may be the worst programs to multithread because the data is inherently serial. Server programs that handle web pages might be among the best because the different clients are inherently independent. Practicing Thread Safety Multithreaded code often requires complex coordination of threads. Subtle and difficult-to-find bugs are common because different threads often have to share the same data so data can be changed by one thread when another isnt expecting it. The general term for this problem is race condition. In other words, the two threads can get into a race to update the same data and the result can be different depending on which thread wins. As a trivial example, suppose youre coding a loop: For I 1 To 10 DoSomethingWithI()Next If the loop counter I unexpectedly misses the number 7 and goes from 6 to 8- but only some of the time- it would have disastrous effects on whatever the loop is doing. Preventing problems like this is called thread safety. If the program needs the result of one operation in a later operation, then it can be impossible to code parallel processes or threads to do it.   Basic Multithreading Operations Its time to push this precautionary talk to the background and write some multithreading code. This article uses a Console Application for simplicity right now. If you want to follow along, start Visual Studio with a new Console Application project. The primary namespace used by multithreading is the System.Threading namespace and the Thread class will create, start, and stop new threads. In the example below, notice that TestMultiThreading is a delegate. That is, you have to use the name of a method that the Thread method can call. Imports System.ThreadingModule Module1 Sub Main() Dim theThread _ As New Threading.Thread( AddressOf TestMultiThreading) theThread.Start(5) End Sub Public Sub TestMultiThreading(ByVal X As Long) For loopCounter As Integer 1 To 10 X X * 5 2 Console.WriteLine(X) Next Console.ReadLine() End SubEnd Module In this app, we could have executed the second Sub by simply calling it: TestMultiThreading(5) This would have executed the entire application in serial fashion. The first code example above, however, kicks off the TestMultiThreading subroutine and then continues. A Recursive Algorithm Example Heres a multithreaded application involving calculating permutations of an array using a recursive algorithm. Not all of the code is shown here. The array of characters being permuted is simply 1, 2, 3, 4, and 5. Heres the pertinent part of the code. Sub Main() Dim theThread _ As New Threading.Thread( AddressOf Permute) theThread.Start(5) Permute(5) Console.WriteLine(Finished Main) Console.ReadLine()End SubSub Permute(ByVal K As Long) ... Permutate(K, 1) ...End SubPrivate Sub Permutate( ... ... Console.WriteLine( pno pString) ...End Sub Notice that there are two ways to call the Permute sub (both commented out in the code above). One kicks off a thread and the other calls it directly. If you call it directly, you get: 1 123452 12354... etc119 54312120 54321Finished Main However, if you kick off a thread and Start the Permute sub instead, you get: 1 12345Finished Main2 12354... etc119 54312120 54321 This clearly shows that at least one permutation is generated, then the Main sub moves ahead and finishes, displaying Finished Main, while the rest of the permutations are being generated. Since the display comes from a second sub called by the Permute sub, you know that is part of the new thread as well. This illustrates the concept that a thread is a path of execution as mentioned earlier. Race Condition Example The first part of this article mentioned a race condition. Heres an example that shows it directly: Module Module1 Dim I As Integer 0 Public Sub Main() Dim theFirstThread _ As New Threading.Thread( AddressOf firstNewThread) theFirstThread.Start() Dim theSecondThread _ As New Threading.Thread( AddressOf secondNewThread) theSecondThread.Start() Dim theLoopingThread _ As New Threading.Thread( AddressOf LoopingThread) theLoopingThread.Start() End Sub Sub firstNewThread() Debug.Print( firstNewThread just started!) I I 2 End Sub Sub secondNewThread() Debug.Print( secondNewThread just started!) I I 3 End Sub Sub LoopingThread() Debug.Print( LoopingThread started!) For I 1 To 10 Debug.Print( Current Value of I: I.ToString) Next End SubEnd Module The Immediate window showed this result in one trial. Other trials were different. Thats the essence of a race condition. LoopingThread started!Current Value of I: 1secondNewThread just started!Current Value of I: 2firstNewThread just started!Current Value of I: 6Current Value of I: 9Current Value of I: 10